By slink -




Q: What is Crontab?

A: Crontab is a program that runs in conjunction with your UNIX

shell that functions as an event timer. If you've ever used one of those

old hunky devices that you slide tabs into at certain points to turn your

lamp on and off at a specific time, you know what crontab does. Crontab

is the digital version of that lamp timer, only it functions to run a

specific program instead of turning the lights at GDN HQ on and off (of

course, they COULD build a device that turns the lights on and off with

the aid of a crontab entry and a bash script... don't think they will



Q: What is Crontab primarily used for?

A: If you have a bot or know what a bot is, that is a good

function for crontab; bots have a tendency to go down at odd times, and

will ALWAYS go down in the unlikely even that the GDN servers go offline.

Crontab can run a script canned botchk that will look for your bot and if

it is not functioning, can reload another copy of the bot into memory.

Crontab can also be used by the administration to switch log files at certain times of day, empty the temporary directory on a certain date and time, and many other wonderful uses.




So, you want to learn how to use crontab, eh? Well first you

have to learn how crontab operates. It runs with a simple config

file, and all you have to do is write one, and stick it into your

crontab and it will run at the specified times.

The way a crontab entry looks:


minute hour day month year program


Each value except the program section can be filled with any number that

fits in the correct range for each division. For example, the minute

field must contain a 2-digit number less than 60. (00 for on the hour, 59

for the minute before). Hour must be less than 24, 00 being midnight and

12 being noon. Day is the days in the month, not to exceed the number of

days in the corresponding month, and so on. Any value may be substituted

by the wildcard *, meaning at ALL values. If you want a program to be run

every minute on the minute (such as a botchk) you would specify a * for

each field. Here is what my crontab looks like:


# slink crontab entry

* * * * * /home/slink/egg/botchk

30 14 * * * /home/slink/.procmail/pon

59 21 * * * /home/slink/.procmail/poff


This runs botchk every minute on the minute, 'pon' at 2:30 p.m. every day,

and 'poff' at 9:59 p.m. each evening. Please note that you MUST specify

the complete path to your program, because crontab is running from the

security level of the system administrator (root) so anything without a

path will be assumed to be in the root directory (/) which you don't have

access to. Be very careful about running crontabs that run every minute

on the minute - if you don't get it right you'll be clogging the system

up. Crontab is designed so that if there are any problems running your

program at the specified time, it will send a warning mail to your

account. This mail will continue and occur each time there is a problem

until it is resolved. I cannot stress enough that this not a program to

be toyed with. It is a very helpful tool for users who need programs to

be run at specified times during the day without their having to be



To get your crontab entry online, simply edit a file (call it whatever you

like) and put in your entry. Be sure it looks good and each line of code

is on one line and that each line has its own separate line. You don't

have to skip lines, but be sure that each entry is distinguishable from

the last. Once you are finished sculpting your crontab entry, save the

file and exit the editor. When you are absolutely sure your crontab is

correct, type in:


crontab yourcrontabfile


For example if you created the file my.crons you would type:


crontab my.crons


You're set.


To check your crontab entries, type:


crontab -l


To remove your entries and stop crontab, type:


crontab -r



*** A note about eggdrop bots and the botchk program:


If you would like to install a crontab to watch over your eggdrop

bot, there are many things to take into consideration. You need to edit

the file botchk in your eggdrop directory and make sure all the

configuration lines are correct. I'm assuming if you've figured out

eggdrop OK so far, this won't be hard. Now: here's the problem: if you

are running eggdrop 1.1.5 or higher (I'm mainly talking to the eggdrop

1.2's out there...) you *MUST* make the bot's nickname in the botchk file

correspond EXACTLY (capitals and small letters COUNT *AS ALWAYS IN UNIX*)

with your *PARTYLINE NICK*. If you don't know what I'm talking about,

re-read your egg.config and check it out. Your bot has a botnick and a

botname - the botnick is used in IRC and the botname is used for botnets

and partyline access. The bot's NAME is the nick that botchk wants. For

*EVERYONE*: To find out the correct nick to put in botchk type (in your

egg dir):


ls pid.*


You should get back something like this:




My bot's nick is Waiter, but his NAME is PartyBOT. Mine said:




That last part there (the PartyBOT - don't type pid or .) is what you need

to put in your botchk. If they don't correspond EXACTLY, your bot will

have several copies of itself running, and that could get ugly.


A final note: Only one process is allowed here at GDN - meaning that if

your bot runs itself a bunch of times, you will be violating the rules,

and will be asked to not run bots in the future.


If you have any problems, questions, suggestions, etc. for this FAQ/HOWTO

send them to - Happy botchk'ing!