|
Bind and the Domain Name System You want to analise your access logs once a week, restart your webserver daily, email your sercurity logs to yourself hourly, run MRTG every minute or reboot your server once a year (well ok probably not the last one). How do you get your server to do this on your, behalf? Cron the Scheduler is your answer. The command you need is: crontab -e The Cron table using favourite text editor
string meaning
------ -------
@reboot Run once, at startup.
@yearly Run once a year, "0 0 1 1 *".
@annually (same as @yearly)
@monthly Run once a month, "0 0 1 * *".
@weekly Run once a week, "0 0 * * 0".
@daily Run once a day, "0 0 * * *".
@midnight (same as @daily)
@hourly Run once an hour, "0 * * * *".
EXAMPLE CRON FILE
# use /bin/sh to run commands, no matter what /etc/passwd says
SHELL=/bin/sh
# mail any output to `andrew', no matter whose crontab this is
MAILTO=andrew
#
# run five minutes after midnight, every day
5 0 * * * $HOME/bin/daily.job >> $HOME/tmp/out 2>&1
# run at 2:15pm on the first of every month -- output mailed to andrew
15 14 1 * * $HOME/bin/monthly
# run at 10 pm on weekdays, annoy andrew
0 1 * * 1-5 mail -s "It's 1am" andrew%andrew,%%Go to bed!%
23 0-23/2 * * * echo "run 23 minutes after midn, 2am, 4am ..., everyday"
5 4 * * sun echo "run at 5 after 4 every sunday"
|