Here's a crazy idea: put each little block of code in its own file. So, create a file with this content:
#!/bin/sh
/usr/bin/su - patrol /usr/adm/best1_default/bgs/scripts/best1collect -
+q >> $1 2>&1
and name it 'start-bgs' in some directory. Then do the same for all other other case blocks and name them similarly. Then your script just becomes:
#!/bin/sh
...
# set $agent to the agent you want to start
cmdpath=$cmd_dir/start-$agent
if ! -x $cmdpath; then
echo Error - start script $cmdpath not found
exit 1
fi
$cmdpath $LOG # pass any relevant parameters here
Then when you need to add/change/delete agents you are just replacing files instead of trying to edit a few lines in a file. This should make things a lot easier to manage, especially if you have several hundred files to update.
It's a crazy idea!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.