I have two things I run on my server that don't come as regular services or whatever. They crash occasionally and also don't autostart on boot (I'm not sure how to do that), so I have a couple little scripts I wrote that cron just runs every five minutes to run the start command if it isn't running. It works fine (I think) but I wondered if there was a better way to do this, or like an official freebsd way.
This is the script I use, in this case the one for deluged:
This is the script I use, in this case the one for deluged:
Code:
if [ -n "$(ps auxw | grep deluged |grep -v grep)" ]
then
# process is running
exit 0
else
# process is not running
su - username -c deluged
exit 0
fi
exit 0