Forum Moderators: bakedjake
I need a shell script running on a CRON job checking to see if a file called "reboot" exists, and if so, executes a kill and then calls a daemon to start:-
if [ -f "reboot" ] ; then
echo "killall -9 SomeApp"
I'm not sure how to then put in the second line? In C/C++ I could do something like@=
if [ -f "/path/to/reboot" ] ; then
{
echo "killall -9 SomeApp"
echo "path/to/SomeApp"
}
Is there a similar way in bash?
Thanks,
TJ
If the application does anything important, like sending email or manipulating data, the killall -9 might cause data loss. It would be better to kill it more gracefully, then wait to see if it finished before restarting it.
Oh, and of course, don't forget rm -f /path/reboot