I have a bash script that monitors a log file using swatch. I have had problems with swatch after the log file is rotated, so I setup a cron job to restart the script after the log file rotation, however this introduces a new problem. the daemon script I use to start swatch in the background becomes unavailable to me, so I end up with many defunct process, or child process that I cannot kill. What is the best way to create a deamon script (in /etc/init.d) that will call my bash script, yet all me to keep control of it and any child processes. The prog needs to run in the background.
Start Free Trial