Manual - Watch It!
In the text, I call my tool "script" and "program" the program you want to watch.
- Copy the script to the same directory, where the program is located.
- Open the script with your favourite editor like pico, nano or vi
-
path = Enter the path to the program you want to watch (e.g. /home/user/dir/ )
-
pid = Name of the .pid-file of that program
-
file = File to run your program
-
cmd = Possible arguments you need to start your program (e.g. |start ), if you don't need it, leave it blank
-
process = Name of the process of your program (use "ps -aux" to find out the process name. If the name is very long, you could cut it at the first space.)
- Set the scripts CHMOD to 755
- Define a cronjob:
-
Enter crontab -e and push return
-
Now you're at the "vi"-Editor and must enter, how often which action should be active
-
Example:
*/1 * * * * /home/user/dir/app.watch > /dev/null 2>&1
Explanation:
every minute in every hour in every week in every month in every year run app.watch and ignore all messages (Unix/Linux is sending system mails, which are not needed for the script)
If you change the 1 to a 2, the script will run every 2 minutes and check, if your program is still running.