Crontab

From Wiki

Revision as of 13:08, 4 July 2008 by Admin (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Cron - Scheduler

Cron = daemon to execute scheduled commands
Crontab = maintain crontab files for individual users

Cron is done by two methods:

  1. In the directories /etc/cron.d /etc/cron.daily etc.....
  2. In crontabs

cron.d = highly configurable cron - equivalent of crontab for the system


List Crontab for a User

crontab -u user -l

Create or Edit a Crontab for User

crontab -e

Remove a Crontab for a User

crontab -r

Examples of Syntax for Cron:

# Min Hour DayOfMonth Month DayOfWeek            Command
55 05 * * * webalizer -c /home/user/public_html/logs/webalizer.conf (Every Day at 05:55am)
23 06 * * * /usr/bin/webalizer -c /home/kartbuilding/webalizer.conf (Every Day at 06:23am)

Default times for cron.daily and cron.weekly

As I use Xen extensively, and have several virtual debian instances running, the default timing of cron.daily and cron.weekly add up when they are all run at the same time on all virtual machines. To change some of the VMs to have different daily, weekly and monthly schedules, you can edit the following:

vi /etc/crontab
Personal tools