IRCServices Auto Restart by Cron
Posted: Fri Feb 04, 2005 3:38 pm
I just thought I should share this, I made it yesterday. I run IRCServices, and have a cron running which is meant to attempt to start it every 3 minutes. If IRCServies is already running the script ends, if not it starts the services. This works very well from a cron, to keep the services from attempting to restart and filling up the log file.
Code: Select all
#!/bin/sh
PID=`ps cax | grep ircservices | cut -f1 -d \ `
DATE=`date +"%I:%M:%S %p on %F"`
LOGFILE=/home/ircd/services/data/ircservices.log
if [ -z $PID ]; then
$HOME/services/sbin/ircservices -dir=$HOME/services/data/;
#log what happened
echo -n "ERROR: Restarting services at: " >> $LOGFILE
echo $DATE >> $LOGFILE
fi