Setting up a crontab
A crontab entry will allow you to check periodically whether Anope is still running, and restart it if not.
First rename the example.chk script that is in Anope path (by default, this is ~/services/data) to services.chk and edit it. You'll need to. modify the CONFIGURATION part of the file. Then ensure that the file is. marked as executable by typing chmod +x services.chk or 755 if you are using ftp edit client, and try to launch the script to see if it works (Anope must not be running when you do this)
When this is done, you'll have to add the crontab entry. Type crontab -e. This will open the default text editor with the crontab file. Enter the following (with correct path):
# Anope binary directory
ANOPATH=/home/YourUserName/services/bin
# Anope data directory
ANODATA=/home/YourUserName/services/data
# Name of the pid file
ANOPIDF=services.pid
# Name of the executable
ANOPROG=services
# Parameters to pass to the executable
ANOARGS=""
#ANOARGS="-debug"
###############################################################
# DON'T EDIT ANYTHING BELOW #
###############################################################
PATH=/bin:/usr/bin:/usr/local/bin
ANOPID=
cd $ANOPATH
if [ -f "$ANODATA/$ANOPIDF" ]
then
ANOPID=`cat "$ANODATA/$ANOPIDF"`
kill -0 $ANOPID 2>/dev/null
if [ $? -eq 0 ]
then
exit
fi
rm -f "$ANODATA/$ANOPIDF"
fi
./$ANOPROG $ANOARGS
Then ensure that the file is. marked as executable by typing chmod +x services.chk, and try to launch the script to see if it works (Anope must not be running when you do this.
When this is done, you'll have to add the crontab entry. Type crontab -e. This will open the default text editor with the crontab file. Enter the following (with correct path):
*/5 * * * * /home/username/services/data/services.chk >/dev/null 2>&1
The */5 at the beginning means "check every 5 minutes". You may replace the 5 with other another number if you want (but less than 60). Consult your system's manual pages for more details on the syntax of the crontab file. Interesting manpages are crontab(5), crontab(1) and cron(8).
Save and exit, and it's installed.