Programming :: RHES 5 - Making Sed Snippet To Be Portable

Jul 27, 2011

I have an odd issue that I am running into. My objective is to insert the following lines at the end of /etc/inputrc on an RHES box:

Code:
# alternate mappings for "page up" and "page down" to search the history
"e[5~": history-search-backward
"e[6~": history-search-forward

I would like this sed snippet to be portable and thus far it's worked. However, I ran into one box where after I ran the snippet, Subsequent sessions lost the ability to use the letter "e". The original version I was using looked like this:

Code:
mv /etc/inputrc /tmp/inputrc.orig
sed 's/'$endif'/
# alternate mappings for "page up" and "page down" to search the history
"e[5~": history-search-backward
"e[6~": history-search-forward
&/' /tmp/inputrc.orig > /etc/inputrc

Then instead of using s/ I thought perhaps i/ would be better so I re-did it as:

Code:
mv /etc/inputrc /tmp/inputrc.orig
sed '/'$endif'/ {
i
i
# alternate mappings for "page up" and "page down" to search the history
i
"e[5~": history-search-backward
i
"e[6~": history-search-forward
}' /tmp/inputrc.orig > /etc/inputrc

Both of these produce the expected result BUT they both resulted in the loss of the letter "e". As I mentioned earlier in the post, this was working on 'newer' RHES 5 and up but I have the misfortune of having to support some older RHES 4 boxes in a closed lab. This particular box is an RHES 4u6.

View 4 Replies


ADVERTISEMENT

Programming :: Grep -oE Not Portable?

Dec 28, 2010

I'm using Zabbix on which I can use give bash command to the agent.This 1-liner will give me all the interfaces with their IPv4 addresses.I have a 2nd expression which returns a checksum so I can detect a difference whenever someone deletes/adds/changes an ipv4 interface.This is the output on my Ubuntu-server:

Code:
~# ifconfig | grep -B1 ' inet ' | grep -oE '(^[a-z0-9:]*|addr:[0-9]+.[0-9]+.[0-9]+.[0-9]+)'
eth0

[code]....

View 8 Replies View Related

Programming :: Portable Pthread Library Out Of 10 Distros?

Mar 10, 2011

im writing a cross-platform software (linux/solaris/mac/bsd) so i was wondering, how portable is pthread library? out of 10 linux distros, how many will have it by default? and does it exists on mac/solaris/bsd by default? or user will have to install it?

View 6 Replies View Related

Server :: Limit On The Number Of Virtual Machines Running On RHES / CentOS XEN?

May 2, 2009

We've been experiencing sudden host server crashes minutes after starting a fourth virtual machine. Our setup looks like:

Dell Poweredge T300
1 x Intel Xeon X3323 Quad Core 2.5 ghz
16 GB Ram
CentOS 5.3 (64 bit)

Server is running a stripped down version of CentOS 5.3 (64-bit), running only the built-in Xen Virtualization Environment. There is no other services running on the server (not samba, httpd, sendmail, cups... nothing except Xen) We've created several virtual machines, and as long as we don't start a fourth virtual machine everything runs smoothly (impresive hardware).

Each virtual server is configured as:

PARAVIRTUALIZED
1 Virtual CPU
1 GB RAM

However, 5 minutes or so after starting a fourth virtual machine, the entire host server crashes and restarts itself. Are we limited by the number of cores on the host machine CPU (4 cores)? 1 for the host and 3 for virtual machines? We've read in forums about other Xen setups running up to 11 virtual machines on less powerful hardware? (a dual core server). Should we be using FULLY VIRTUALIZED virtual machines instead? Is the number of XEN virtual machines in fact limited by the number of cores? If so, how can someone run several virtual machines on a single core host?

By the way, we were replacing a previous Dell Server (Poweredge 2600 with 512 MB Ram and a single Xeon single core processor running Open Virtuozzo). We were able to run up to 16 virtual machines at the same time. Of course none of the machines endured hard work (testing environments, etc). But hey, my point is that we expected to get a much higher number of virtual machines on this new hardware.

View 8 Replies View Related

Ubuntu :: GEDIT DEFAULT Snippet - Doesn't Automatically Activate The Document

Mar 12, 2010

I'm a ruby on rails programmer, and I installed a snippet that supports .rhtml or .html.erb code (the rails code) in GEDIT HOwever, everytime I make a new .html.erb file, the snippet doesnt automatically activate the document. I have to manuelly go up to View=> Highlight Mode => Scripts => RHTML How can I set it so that all the files that have an .html.erb or .rhtml extension automatically use that snippet?

View 1 Replies View Related

Ubuntu Networking :: Samba Share Denies Write, Smb.conf Snippet Included?

Aug 10, 2010

I'm a very -slightly- advanced Samba user. I believe I know the basics of editing the smb.conf and I know to use smbpasswd to update the Samba users database.I have a group of identical shares.They are readOnly for the group @movies-play and they are (supposed to be) writeable by specific users. The readOnly group works great, no prob there, but I cannot get write access for the specified users. They are in the Samba user database using smbpasswd -a mark and neelix.Here is the share section in my smb.conf...

Code:
[movies-usb3]
path = /media/usb3/movies
guest ok = no[code]....

I have the workgroup and netbios info set. I have security=user set. The folder 'movies' in the path above is owned by 'mark' so it seems I should be able to write in it but I can't.I'm connecting to the share (it's on a server running Lucid) from my laptop (running Lucid. I added this mount info to fstab...

Code:
//spock/movies-usb3 /media/spockmovies3 cifs credentials=/home/mark/.smbpasswd 0 0
Of course spock in the hosts file so it resolves. I can see the share fine, just can't write.

View 9 Replies View Related

Programming :: Making An Awk Script ?

Sep 29, 2010

Making an awk script. If you tell me to read the documentation.. I know.. you're right.

By the way, here is some input

Code:

My awk program has to work in this way:

until the end of the document if the beginning of the line is "START11" while the beginning of the line is different form "END11" print the whole line (print the "END11" line too)

View 1 Replies View Related

Programming :: Making A Graph In C

Dec 1, 2010

I am trying to understand how can I make a graph in C. So I wrote some program.

Code:
#include "declarations.h"
graph root = NULL;
int main()
{

[Code]....

View 6 Replies View Related

Programming :: Draw A Circle In C++ Without Making Use Of BGI

Apr 10, 2010

How can one draw a circle in c++ without making use of BGI.

View 4 Replies View Related

Programming :: Making A Graphic Animation In C#?

May 3, 2011

I'm trying to create something like this:[URL]...when you press "fire" you see the graphic.My program already does all the math, but what i want is that animation of the projectile moving depending on the entered data.i really don't know how to accomplish that.I'm using Gtk#.what would i need to create something like that??

View 1 Replies View Related

Programming :: Making A Scrambler From Python?

Jul 28, 2011

was making a scrambler from python and this is what i have

# Scramble word re-arrange characters
import random
scrambler= raw_input("put a word and i will unscramble:")

[code]....

View 9 Replies View Related

Programming :: Making A 1 Command Line Argument?

Jun 8, 2010

I need to write a script that will take 1 command line argument. The argument will be a username. The script will determine if the user exists on the system and will print an error if it does not. If the user does exist it will determine if the user is currently logged in, if the user is not logged in it will determine the last time the user logged in and display the file in the users home directory that was most recently modified.

View 2 Replies View Related

Programming :: Get Started With Making 'a SIMPLE Dock'?

Mar 22, 2011

This is probably hopelessly ambitious as I'm not a C or C++ programmer (I normally like to stick to scripting languages like BASH or Perl). Basically I'm looking on good advice to get me started with writing a Application Dock with the functionality of the OSX dock but without the overly flamboyant graphics that have characterised the Linux versions.At the moment the closest I've found to what I would like is bbdock. However it falls well short of the functionality of what I would like.

What bbdock does is read a file to create an icon for the openbox dock/fluxbox slit/wmaker whatever that launches an application when first clicked, shows an little arrow when the application is running, and brings the application to the fore when clicked once running.Here's a screenshot of it doing just that.The drawback to bbdock is that it doesn't really look for running applications, only those launched from bbdock. So for example it wont notice if I've launched an instance of pcmanfm from the openbox menu. And therefore it obviously also doesn't add icons for other applications that are running.

What I would like to be able to do is detect new running applications and add a bbdock icon for them. Also to detect if an application already with a shortcut has been run and update it's status to show it's open. Probably have an up and down arrow to move the icons up and down when there are too many to fit on the screen. None of the above needs fancy animation. The fade to gray effect used by bbdock is quite nice and could probably be augmented with a fade in and out to grey to represent another action, say fading to grey and back when launching and greyed when iconified.So, my question is what do I need to get started doing this? Am I best using the pretty outdated bbdock wmaker dockapp style? What functions and libraries am I likely to need to achieve the effects I want? Are there any examples of how to monitor running applications (well windows and figure out what constitutes a new application) that I could look at for inspiration. Is there anyone who's into C++ for linux who would be interested in helping me out to get this small project working?

View 8 Replies View Related

Programming :: Bash: Making A Variable Out Of Two Other Variables?

Mar 18, 2010

I need to find the value of:

Code:
$Namenumber
My script asks for the name you want to look up and I want it to return the value of $Namenumber

I was thinking:

Code:
number=$"$name"number
but this returns

Code:
$Namenumber

but does not actually resolve what the variable $Namenumber is equal to.

View 4 Replies View Related

Programming :: Making Existing MS Excel App Web Based

Jun 7, 2010

I have a LAMP based web hosting account (BlueHost). I have an existing simple MS Excel application which I would like to make it web based. However I am not sure what tools or features of PHP are out there that will aid me with this task. Here are some details:

1. I don't want to create an entire Excel program online. For that there are plenty of existing applications like Google Docs, MS's own online version of Excel, etc.
2. My current excel file uses some of the following excel functions:
a) SUM
b) Product Sum
c) Conditional Formatting (like changing font color if an amount is below a threshold, etc.)
d) Sorting (Date, Amount)
e) Drop Down Box to select pre-defined values

3. Ability to add/delete/modify a entry (row)
4. I don't care whether the application has the same look-n-feel as MS Excel.

As you can see it is a very simple home grown excel application with few basic mathematical functions. Here are some few thoughts that I have currently in my mind:

i) Just start coding intuitively as you would develop a normal web based application.
ii) Do (i) but use some of the PHP's excel oriented helper functions (COMs?) if there are any
iii) Use completely a different set of tools permitting that they run on LAMP environment.

I could have started with (i) but before making a costly mistake I thought I would get some opinion from the community to see if this is the right approach.

View 1 Replies View Related

Programming :: Making A Debian Source Package?

Jan 14, 2011

I'm building a debian source package to upload on my launchpad PPA. Does anyone know what file I should create or edit to make a menu entry for the app? Or a link to some *specific* doc? (The debian doc is quite overwhelming...)

View 2 Replies View Related

Programming :: Making A Project Distribution Folder?

Jun 25, 2010

I'm trying to make my first c project (a simple tic tac toe console game), and I am wondering how to make a final product (copy all source code files to a distribution folder upon compilation). Should I use a bash script or should I use a makefile to make the distribution folder? I'm not terrible familiar with either; I have a basic makefile to make an executable, and that's about all I know of make.

And if I do use a bash script, how do I copy over source code files? I tried cp ./*.c and cp ./*.h, but I think the script read it literally as moving a file named ./*.c (and ./*.h), and couldn't find it.

My makefile is pretty much this:

Code:
objectFiles = main.o io.o board.o game.o
ttt : $(objectFiles)
cc -o ttt $(objectFiles)

View 2 Replies View Related

Programming :: Making The Mplayer To Skip Some Files?

Jun 6, 2010

GNU/Linux kernel 2.6, Slackware 12.0
MPlayer 1.0rc2-4.1.2
GNU Bash 3.1.17

I've got a set of MP3 files on dir .../foo/ and I want mplayer to play them sequencely but skipping some of them. If I run 'mplayer *' this will do but ofcourse won't skip any files. I think a shell script could be written to do that. It would be something like this (using some pseudocode):

#!/bin/bash
#After an example from Intro_Linux by M. Garret.
LIST=$(ls *.mp3)

[code]....

View 3 Replies View Related

Programming :: Making Sure Script Is Running In Bash?

Feb 15, 2011

is this a good way of doing it? Shall I use & when starting the new process? Itested in bash and dash.

testbash=$(ps -e | grep $$ | grep bash)
if [ 0 = ${#testbash} ]; then
echo "new process"

[code]...

View 11 Replies View Related

Programming :: Created Python Programs - Making Changes To Improve?

Dec 17, 2008

I have list of programs which I have created during the past few days, all the programs are attached in txt files, and if anyone can do favor, and double check if they work, and what changes I can make to make it look different, or to improve it.

View 9 Replies View Related

Programming :: Making Sure Only One Instance Of Script Runs Concurrently

Dec 11, 2010

I need to write a shell script that will be run from cron every minute or so. The script will use rsync to keep some folders across several machines in sync. I am very new to shell scripting so some answers might seem obvious but they are not to me:

1. How do I check at the beginning of the script if the script is already running and abort if it is? I saw that most processes use a PID file for that but I am not sure this is the right case for that and in fact how to do it exactly

2. Assuming the list of target machines/dirs to sync are supposed to come from some config file. How should I code that? Just use the normal shell tools that I already know (cut etc) or is there a better way?

View 6 Replies View Related

Programming :: Do Not Miss Any Cases While Making The Test Case Doc?

Jul 28, 2010

Few months back I learnt a *few* concepts about bits/bytes and started writing a program for bit packing in C++. Now that program has grown upto 600 lines and I am still working on it. Yesterday I realized I missed some special cases due to which the program was malfunctioning. Now I have modified the program and it is working properly but I think If I would have designed all the possible test cases before writing the code, I would have finished the program long ago.

I. What is proper way to design the test cases before coding?

II. How should I make sure that I do not miss any cases while making the test case doc. ?

III. Does writing test cases prior to coding solve messy code issues or should I consider something else ?

View 8 Replies View Related

Programming :: Test Program Without Making A Copy Outside The Git Working Dir?

Jan 30, 2010

I was windering, if you are writing a C program, I don't think you are supposed to commit the .o files and executables. How can you test your program without making a copy outside the git working dir?

View 3 Replies View Related

Programming :: Error With Compiling Program 'can Not Be Used When Making Shared Object'

Oct 14, 2010

I've got an error with compiling a program: relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC /usr/lib/python2.5/config/libpython2.5.a: could not read symbols: Bad value collect2: ld a retourn 1 code dtat d'excution make[2]: *** [bindings/_yafqt.so] Erreur 1.

View 1 Replies View Related

Programming :: Making Dynamic Memory As 64kB Aligned In C Lang?

Aug 17, 2010

I doing malloc and getting the chunk of dynamic memory. Now I want it to align that memory to 64KB. This means that the address of the memory starts from 64KB or multiple of 64KB.

View 3 Replies View Related

Programming :: ASM - Making A Multimedia Library To Speedup Vector And Matrix Computation

Sep 2, 2010

I'm making a multimedia library to speedup vector and matrix computation. But I'm getting a strange error, in this code

[Code]....

View 4 Replies View Related

Programming :: Got "Build Failed" When Making Debug With Mono Developer?

Feb 23, 2010

I've installed mono developer, but when I want to make debug I got this message : Build failed. ApplicationName='/usr/bin/gmcs', CommandLine='"@/tmp/tmp17a7a5e2.tmp"', CurrentDirectory= ...

View 1 Replies View Related

Programming :: How To Compile / Simple Tutorial For Making Simple Program

Oct 7, 2010

i'm a college student studying pc programing, and i was given today a special work and i have to program using miranda... which i've never used it >.< can anyone give me a hand to where to download, how to compile, and a simple tutorial for making a simple program or something?

View 3 Replies View Related

Ubuntu Servers :: How To Set Up A Portable?

May 30, 2010

Due to hardware failure I have had to set up a server several times. Each time it takes more than a day to set it up from scratch and import the databases etc. I would like a solution that separates all the data, including the configuration files, from the binaries and stores the data on a portable medium that can be quickly used to setup a new server.

Here are the details. I don't use Apache Friends' xampp, instead I set up apache2, php, mysql according to the instructions in [URL].. So the php, css, html etc files are in /var/www, the apache config files are in /etc/apache2 and the mysql data is in /var/lib/mysql. What is the simplest way of making the data and configuration files portable so that I can quickly set up the same server on a new machine that I have first installed Ubuntu on?

Can I put the above mentioned partitions and directories on a usb drive? Should I always make regular dumps of the mysql data and use the dump files instead? Should I keep the whole lot on the local hard drive and find a way using rsync, unison etc to mirror the files onto another potential backup machine on a regular basis - this is not a trivial operation if all the file permissions and ownerships are to be preserved.

View 7 Replies View Related

General :: Autobackup On Portable USB HDD

Oct 13, 2010

I got a CentOS 5.3 fileserver machine (no monitor/kb/mouse). I'd like to "pair" it with a specific USB drive, so that when this USB drive is connected and mounted it would start a backup - just a simple cp /source /target will do for now - it's the "autorun on mounted a specific USB drive" part I can't really solve. Is there an elegant way to do this some sort of autorun? My only really rough idea to do it is to check if the USB drive is available with a script run in crontab every minute :-

View 7 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved