File: crontab.script

package info (click to toggle)
mrtg 2.9.17-4
  • links: PTS
  • area: main
  • in suites: woody
  • size: 5,140 kB
  • ctags: 1,517
  • sloc: perl: 22,688; ansic: 3,536; sh: 1,309; makefile: 319; php: 227; awk: 213; csh: 49; exp: 16
file content (45 lines) | stat: -rwxr-xr-x 1,305 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#! /bin/sh
#
# Crontab script for ircstats2
#------------------------------
# You can use that script to check whether the stats generation script is
# running.
#
# No bugs are known in this software. So if it crashes, please tell me, even if
# you don't know anything about the crash !
#
# To check for your script every 10 minutes, put the following line in your
# crontab:
#    0,30 * * * *   /home/mydir/crontab.script
# And if you don't want to get email from crontab when it checks you script,
# put the following in your crontab:
#    0,30 * * * *   /home/mydir/crontab.script >/dev/null 2>&1
#

# change this to the directory you run the script from:
ircstatsdir="/home/lucas/ircstats2"

########## you probably don't need to change anything below here ##########

cd $ircstatsdir

if test -r ircstats2.pid
then
  pid=`cat ircstats2.pid`
  if `kill -CHLD $pid >/dev/null 2>&1`
  then
    exit 0
  fi
  echo ""
  echo "Stale ircstats2.pid file, erasing..."
  rm -f ircstats2.pid
fi

echo ""
echo "ircstats2.pl restarting ..."
echo "This software is supposed to be bug-free. If the bot has to restart,"
echo "and if that's not for a good reason (server reboot for example), please notify"
echo "the author (lucas@schickler.net) even if you don't know why the script crashed."

./ircstats2.pl
exit 0