/[cvs]/eggdrop1.9/scripts/botchk
ViewVC logotype

Contents of /eggdrop1.9/scripts/botchk

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.7 - (show annotations) (download)
Wed Dec 17 00:58:02 2003 UTC (15 years, 4 months ago) by wcc
Branch: MAIN
CVS Tags: HEAD
Changes since 1.6: +42 -71 lines
* More cleanups.
* Updated alltools.
* botchk works now.

1 #! /bin/sh
2 #
3 # $Id: botchk,v 1.6 2002/04/16 22:40:59 ite Exp $
4 #
5 # This is a script suitable for use in a crontab. It checks to make sure
6 # your bot is running. YOU NEED A SEPARATE CRON JOB FOR EACH BOT. If your
7 # bot isn't found, it'll try to start it back up.
8 #
9 # You'll need to edit this script for your bot.
10 #
11 # To check for your bot every 10 minutes, put the following line in your
12 # crontab:
13 # 0,10,20,30,40,50 * * * * /home/mydir/mybot/botchk
14 # And if you don't want to get email from crontab when it checks you bot,
15 # put the following in your crontab:
16 # 0,10,20,30,40,50 * * * * /home/mydir/mybot/botchk >/dev/null 2>&1
17 #
18
19 # Change this to the directory you run your bot from (capitalization COUNTS):
20 botdir="/home/mydir/mybot"
21
22 # Change this to the name of your bot's config file (capitalization COUNTS):
23 botconfig="config.xml"
24
25 # change this to the botname of your bot (capitalization COUNTS):
26 botname="eggdrop"
27
28 # change this to the name of your bot's userfile (capitalization COUNTS):
29 userfile="users.xml"
30
31 ########## you probably don't need to change anything below here ##########
32
33 cd $botdir
34
35 # Is there a pid file?
36 if test -r pid.$botname; then
37 # There is a pid file -- is it current?
38 botpid=`cat pid.$botname`
39 if `kill -CHLD $botpid >/dev/null 2>&1`; then
40 # Yes.
41 exit 0
42 fi
43 echo ""
44 echo "Stale pid.$botname file, erasing..."
45 rm -f pid.$botname
46 fi
47
48 if test -r CANTSTART.$botname; then
49 if test -r $userfile; then
50 echo ""
51 echo "Userfile found, removing check file 'CANTSTART.$botname'..."
52 rm -f CANTSTART.$botname
53 fi
54 fi
55
56 # Test if we have run botchk previously and didn't find a userfile.
57 if test ! -f CANTSTART.$botname; then
58 echo ""
59 echo "Couldn't find bot '$botname' running, reloading..."
60 echo ""
61 # Check for userfile and reload bot if found.
62 if test -r $userfile; then
63 # It's there, load the bot.
64 ./eggdrop $botconfig
65 exit 0
66 else
67 # No userfile.
68 echo "No userfile. Could not reload the bot..."
69 echo "No userfile." > CANTSTART.$botname
70 exit 1
71 fi
72 fi
73
74 exit 0

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23