Results 1 to 1 of 1
Enjoy an ad free experience by logging in. Not a member yet? Register.
- Join Date
- May 2009
SLES 10.3 Run shell script from cron to restart service
#!/bin/bash # ndsd restart command RESTART="/etc/init.d/ndsd restart" # path to pgrep PGREP="/usr/bin/pgrep ndsd" # find ndsd pid $PGREP if [ $? -ne 0 ] then $RESTART echo "NDS has been restarted." | mail -s 'Server NDS Crash' insert_email fi
It will check for the pid, if not found, it WILL restart it.
The issue I have, is when it is being run from cron, it will not restart the service.
The script runs in cron. I can tell because I get the email saying that it has crashed, but it does not start it back up.
Also, since it does not restart, I get numerous emails (one for each time the job runs in cron. Every 5 minutes).
As a matter of fact, I have ran multiple different shell scripts from cron, and none will start/stop/restart any service. Is there something I'm missing?