mirror of
https://github.com/unrealircd/unrealircd.git
synced 2026-06-12 17:14:46 +02:00
Add "./unrealircd croncheck" which will start UnrealIRCd if it isn't running and bail out quietly otherwise. This can be used from *surprise!* crontab. The old broken cron script has been removed. (#4508)
This commit is contained in:
@@ -1 +0,0 @@
|
||||
0,10,20,30,40,50 * * * * @IRCDDIR@/ircdcron/ircdchk >/dev/null 2>&1
|
||||
@@ -1,47 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# UnrealIRCD Crontab v2.1
|
||||
# $Id$
|
||||
#
|
||||
# This is a script suitable for use in a crontab. It checks to make sure
|
||||
# your ircd is running. YOU NEED A SEPARATE CRON JOB FOR EACH IRCD. If your
|
||||
# ircd isn't found, it'll try to start it back up.
|
||||
#
|
||||
# You'll need to edit this script for your ircd.
|
||||
#
|
||||
# To check for your ircd every 10 minutes, put the following line in your
|
||||
# crontab:
|
||||
# 0,10,20,30,40,50 * * * * /home/mydir/ircdchk
|
||||
# And if you don't want to get email from crontab when it checks you ircd,
|
||||
# put the following in your crontab:
|
||||
# 0,10,20,30,40,50 * * * * /home/mydir/ircdchk >/dev/null 2>&1
|
||||
#
|
||||
# change this to the mail address to mail output to:
|
||||
# MAIL=me
|
||||
|
||||
# These values shouldn't need to be changed
|
||||
|
||||
# The path to the ircd binary
|
||||
ircdexe="@BINDIR@"
|
||||
|
||||
# The path to the ircd pid file
|
||||
ircdname="@IRCDDIR@/ircd.pid"
|
||||
|
||||
########## you probably don't need to change anything below here ##########
|
||||
if test -r $ircdname; then
|
||||
# there is a pid file -- is it current?
|
||||
ircdpid=`cat $ircdname`
|
||||
if `kill -CHLD $ircdpid >/dev/null 2>&1`; then
|
||||
# it's still going
|
||||
# back out quietly
|
||||
exit 0
|
||||
fi
|
||||
echo "UnrealIRCd Crontab notice:"
|
||||
echo ""
|
||||
echo "Stale $ircdname file (erasing it)"
|
||||
rm -f $ircdname
|
||||
fi
|
||||
echo ""
|
||||
echo "Couldn't find the ircd running. Reloading it..."
|
||||
echo ""
|
||||
$ircdexe
|
||||
+12
-1
@@ -89,6 +89,17 @@ elif [ "$1" = "restart" ] ; then
|
||||
fi
|
||||
fi
|
||||
$0 start
|
||||
elif [ "$1" = "croncheck" ] ; then
|
||||
if [ -r $PID_FILE ] ; then
|
||||
kill -CHLD `cat $PID_FILE` 1>/dev/null 2>&1
|
||||
if [ "$?" = 0 ]; then
|
||||
# IRCd is running, bail out silently.
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
# PID file not found or found but stale
|
||||
echo "UnrealIRCd is not running. Starting now..."
|
||||
$0 start
|
||||
elif [ "$1" = "mkpasswd" ] ; then
|
||||
@BINDIR@/unrealircd -P $2 $3
|
||||
elif [ "$1" = "version" ] ; then
|
||||
@@ -182,5 +193,5 @@ __EOF__
|
||||
echo ""
|
||||
echo "Thanks!"
|
||||
else
|
||||
echo "Usage: unrealircd start|stop|rehash|restart|mkpasswd|version|gencloak|upgrade-conf"
|
||||
echo "Usage: unrealircd start|stop|rehash|restart|mkpasswd|version|croncheck|gencloak|upgrade-conf"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user