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

Annotation of /eggdrop1.6/scripts/botchk

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


Revision 1.1 - (hide annotations) (download)
Mon Sep 13 14:36:18 1999 UTC (19 years, 10 months ago) by segfault
Branch: MAIN
Initial commit based off of .29 cvs

1 segfault 1.1 #!/bin/sh
2     #
3     # new botchk (for eggdrop 1.1)
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/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/botchk >/dev/null 2>&1
17     #
18    
19     # change this to the directory you run your bot from:
20     botdir="/home/mydir/mybot"
21    
22     # change this to the name of your bot's script in that directory:
23     botscript="mybot"
24    
25     # change this to the nickname of your bot (capitalization COUNTS)
26     botname="Doofy"
27    
28     # change this to the name of your bot's userfile (capitalization COUNTS)
29     userfile="Doofy.user"
30    
31     ########## you probably don't need to change anything below here ##########
32    
33     cd $botdir
34     if test -r pid.$botname; then
35     # there is a pid file -- is it current?
36     botpid=`cat pid.$botname`
37     if `kill -CHLD $botpid >/dev/null 2>&1`; then
38     # it's still going
39     # back out quietly
40     exit 0
41     fi
42     echo ""
43     echo "Stale pid.$botname file (erasing it)"
44     rm -f pid.$botname
45     fi
46     echo ""
47     echo "Couldn't find the bot running. Reloading it..."
48     echo ""
49     # Check for userfile first
50     if test -r $userfile; then
51     # It's there, load the bot
52     ./$botscript
53     exit 0
54     fi
55     if test -r $userfile~new; then
56     # Bot f*@!ed up while saving the userfile last time. Move it over.
57     echo "Userfile missing. Using last saved userfile..."
58     mv $userfile~new $userfile
59     ./$botscript
60     exit 0
61     fi
62     if test -r $userfile~bak; then
63     # Userfile is missing, use backup userfile.
64     echo "Userfile missing. Using backup userfile..."
65     cp $userfile~bak $userfile
66     ./$botscript
67     exit 0
68     fi
69     # Well, nothing to work with...
70     echo "No userfile. Could not reload the bot.."
71     exit 0

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23