This repository has been archived on 2025-02-12. You can view files and clone it, but cannot push or open issues or pull requests.
NeoStats/cronchk

52 lines
1.4 KiB
Text
Raw Permalink Normal View History

2000-06-10 09:14:03 +00:00
#!/bin/sh
#
2002-10-24 14:28:26 +00:00
# NeoStats Crontab v2.1
2003-09-22 13:13:25 +00:00
# $Id: cronchk 583 2003-09-20 10:35:54Z Fish $
2000-06-10 09:14:03 +00:00
#
# This is a script suitable for use in a crontab. It checks to make sure
2002-10-24 14:28:26 +00:00
# your neostats is running.
# if NeoStats isn't found, it'll try to start it back up.
2000-06-10 09:14:03 +00:00
#
2002-10-24 14:28:26 +00:00
# You'll need to edit this script for your copy of NeoStats
2000-06-10 09:14:03 +00:00
#
2002-10-24 14:28:26 +00:00
# To check for your Neostats every 10 minutes, put the following line in your
2000-06-10 09:14:03 +00:00
# crontab:
# 0,10,20,30,40,50 * * * * /home/mydir/ircdchk
2002-10-24 14:28:26 +00:00
# And if you don't want to get email from crontab when it checks you Neostats,
2000-06-10 09:14:03 +00:00
# put the following in your crontab:
# 0,10,20,30,40,50 * * * * /home/mydir/ircdchk >/dev/null 2>&1
#
2002-10-24 14:28:26 +00:00
# This file originally came from UnrealIRCd
2000-06-10 09:14:03 +00:00
# change this to the mail address to mail output to:
MAIL=me
# change this to the directory you run your ircd from:
2002-10-24 14:28:26 +00:00
dir="/path/to/neostats"
2000-06-10 09:14:03 +00:00
2002-10-24 14:28:26 +00:00
# change this to the name of your Neostats file in that directory:
ircdexe="neostats"
2000-06-10 09:14:03 +00:00
# I wouldn't touch this if I were you.
ircdname="neostats.pid"
2000-06-10 09:14:03 +00:00
########## you probably don't need to change anything below here ##########
cd $dir
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 ""
2002-10-24 14:28:26 +00:00
echo "Couldn't find NeoStats running. Reloading it..."
2000-06-10 09:14:03 +00:00
echo ""
./$ircdexe