Advertisement

How to setup Crontab for an Eggdrop Bot


Cron is UNIX/Linux/BSD service or daemon to execute commands or scripts at given time and date. It is also known as the clock daemon that executes commands at specified dates and times according to instructions in a file.

Editing the botchk file


The botchk script and crontab are used to automatically restart the bot if the shell it's on reboots or if the bot process is killed for some other reason.
You can find the botchk file in the scripts directory (in the directory you installed the bot to). Newer versions of Eggdrop (from 1.3.24i) have a script included that automatically configures botchk and crontab for you.

In telnet, simply switch to the scripts directory and type chmod 700 autobotchk then ./autobotchk <config> -dir /home/botdir -noemail, where /home/botdir is the directory you installed the bot to and <config> is the name you chose for your config file.


Otherwise, you can edit the botchk file and insert the required crontab entry manually. There are only four things you need to set in the botchk file, all of which are pretty self explanatory. Once you've edited the botchk file, you need to add an entry to your crontab. Here's the best method:

1) Your crontab line should look like:


0,10,20,30,40,50 * * * * /home/botdir/scripts/botchk >/dev/null 2>&1


This will run the botchk script every 10 minutes, which checks that the bot is running and restarts it if it isn't. You just need to change the /home/botdir part to the correct path to the bot on your shell (type pwd to show this). Type the line in Notepad or some place where you can highlight and copy it from.


2) Type crontab -e. This should bring up the vi editor (it will appear as a bunch of lines starting with the ~ character), but may open up the pico editor instead.
3) For vi, do the following - hit ctrl-L, hit i, paste the crontab line you created earlier, hit Esc, type :wq! then hit Enter (if you make a mistake doing this, just hit Esc and start over).

For pico - paste the crontab line you created earlier, hit ctrl-X, hit Y when prompted to save, hit Enter when prompted for a filename.

You can view your current crontab entries by typing crontab -l.
To clear your crontab, use crontab -r (may be crontab -d on some shells).

Setting up a crontab using autobotchk


Included with your Eggdrop is a utility called 'autobotchk'.
Using autobotchk is probably the fastest way of creating your botchk and adding it to crontab with just a few required steps:

Type 'cp scripts/autobotchk ..'.
Type './autobotchk <Eggdrop config file>'.

This will hopefully crontab your bot using the default setup.
If you want a list of autobotchk options, type './autobotchk'.
An example with options would be:

./autobotchk eggdrop.conf -noemail -5

This would setup crontab to run the botchk every 5 minutes and also
to not send you e-mail saying that it restarted your bot.