in reply to I need some pearls of wisdom

Just a couple of comments...

The above suggestion is good advice, but I never liked the way that perl's -i option worked. One problem is that if you accidentally run your script twice you've just blown away your originals. Also, it's not 'transactional'. For some edits I want to be able to die and not have the original file change. For quick-and-dirty operations it can work well, but I wouldn't recommend using it for a massive editing process like you're describing. Rather, I would recommend that you:

Making the back-up copies can be done easily using the --parents switch to cp, i.e.:

mkdir backups find ... -exec cp --parents '{}' backups ';'

and this will preserve the parent path of the found files.

The other comment I have is that if you have several hundred files to edit, it might be helpful to reconsider how they are organized. It seems that your scripts are organized by <verb> <noun>, i.e. the script is the verb and the thing to act on is passed as an argument. You might look into changing this around so that the noun selects the script and the action is supplied as an argument. So instead of running:

$ start bgs

you would start up the bgs daemon by running:

$ bgs start

This will make your scripts more 'object oriented' and place similar concerns in the same script. Also, when you deploy a new version of the bgs daemon, you wouldn't have to edit all the 'start' scripts to include the new bgs code, you would just be replacing one bgs control script. Anyway, it's something to consider to see if it's applicable to your situation.

Replies are listed 'Best First'.
Re^2: I need some pearls of wisdom
by wcj75019 (Acolyte) on Feb 24, 2008 at 01:49 UTC
    It is not an option to how I start it up. Each one of these files gets rsync'd to a server. This isn't even the confusing part. I also have to modify an sh script that sends a trap to Openview. But, I am not going to add that into the mix. till I figure the first part out. But, If I can figure this out. That will be easy. You are just changing one line with the code above. I need to either change the line, leave it alone. Or add a whole new line to it. I need to get motivated and start playing with it some more.