Under Unix, running programs periodically is the job of cron
. Users can edit their jobs into the crontab using the crontab -e
command (set your EDITOR
environment variable to your favorite editor).
The format of the crontab is described in crontab(5) which you read with
man 5 crontab
The most common gotcha for new cron users is that cron jobs are run with a minimal environment; not even PATH
is exported so you have to set PATH
in your program.
So where does your program's output go? Any output on stdout or stderr will be mailed to your account. If you want it somewhere else, your crontab line must redirect the output, e.g. with a crontab entry like this (note: sh syntax, not csh syntax!):
# Quarter past 8 on Saturdays.
15 20 * * 6 /home/user/bin/A.pl >/home/user/A.stdout 2>/home/user/A.stderr