i want to create a crontab to restart my jboss server every night. Nothing special and i thought it would be easy....
I got this crontab:
0 22 * * * /home/user/SoftZ/jboss-5.1.0.GA/bin/jboss_restart.sh
So every night at 22h it launches jboss_restart.sh which is as this:
#!/bin/sh
echo restarting jboss >> /home/user/SoftZ/logz.log
for pjboss in `ps -Af | grep -v grep | grep jboss | grep -v jboss_restart.sh | awk '{ print $2 }'`
do
kill -9 ${pjboss}
echo Killing >> /home/user/SoftZ/logz.log
done
echo Starting >> /home/user/SoftZ/logz.log
sh /home/user/SoftZ/jboss-5.1.0.GA/bin/run.sh -c all &
echo Finish >> /home/user/SoftZ/logz.log
So it's basic... the cron starts well and jboss_restart.sh too, everything is logged in logz.log and active process of jboss is killed but run.sh isn't started..... I tried several things such as chmod on the script, change the synthax of the command and crontab,... but nothing works. It's very annoying.
Could you help me please. Thanks in advance.