No problem. If anything isn't clear, just holler.
I did edit it a little though; minor stuff that doesn't affect operation.
I would have thrown in a "cleanup" mode, but the way the script works, there's very little chance (if any) that it would become zombied. If it does, then there's probably a bigger problem than email to worry about. If you'd like to add a cleanup-type of option to the script (as a tinkering exercise or if it becomes necessary), then I'd follow keefaz's lead: something simple like echoing the pid of the script to a file and then removing it on successful completion of the script.
And I forgot to mention, the cron entries were just arbitrarily picked by me. If you wanted to maintain the once per two minutes routine, you could change them to:
Code:
0-58/2 * * * * /path/to/script local
1-59/2 * * * * /path/to/script external
That'll do the same thing as previously: stagger the scripts so only one runs at a time. "local" executes on every even minute of the hour, and "external" executes on every odd minute of the hour. If the format is a little unclear, here's the Cliff's Notes version (
man 5 crontab for gory details):
first field: minute
all other field: hour, day of month, month, day of week
if given a range, (such as 1-5) then the command is executed on every matching field within the range (i.e. at minute 1, 2, 3, 4, and 5)
If given a range followed by a slash, the number after the slash gives the "step" amount.
An asterisk means match any value