[NTLUG:Discuss] Script help

Ben Weatherall BWeatherall at pdxinc.com
Wed Sep 15 11:29:10 CDT 2010


<Previous thread snipped for brevity>

There have been several references to rewriting (primarily with respect to using full paths and removing the sleep so cron can re-execute it) and to using cron.

Here is an alternate approach - use the init scripts to start the process (which would capture its PID and any other startup info you wanted/needed plus initiate a cron job), stop (kill the PID and stop the cron job) and status (indicate if the process is running or not and whether the cron job is active). The script itself would sleep for a long time, but be written to be woken up by a specific set of signals (stop, timeout, execute, status, etc.). The cron job would be set to send an execute signal to the process.

This may be a little more complicated than what you want, but it is a acceptable practice in predictive systems architecture. Be careful though that your execution times do not exceed the cron interval in a worst case scenario. An alternative to cron might be to have the script execute an 'at' command to wake it up. 

One final thing, while PIDs will indeed wrap, if the cycle time is short (I think your example was 1 second), then being able to find it to kill it (rogue process) might be almost impossible.

_________________________________________________
BEN WEATHERALL  |  Configuration Manager 
PDX-NHIN-Rx.com



More information about the Discuss mailing list