Jump to Navigation

039 - crontab

The crontab command, like at, schedules jobs for specific times. However, crontab is for recurring jobs,
such as "Run this command at midnight on the second Tuesday of each month." To make this work,
you edit and save a file (crontab). The superuser can add the option -u username to work with other's
crontab files. Crontab files contain one job per line.

$ crontab -e  (Edit your crontab file in your default editor)

$ crontab -l   (Print your crontab file on standard output)

$ crontab -r   (Delete your crontab file)

$ crontab myfile  (Install the file myfile as your crontab file)

Crontab for Drupal:
---------------------------------------------------------------------------------

00 * * * * /usr/bin/wget -O --q -t 1 http://dname/cron.php
45 2 * * * curl --silent --compressed http://example.com/cron.php
45 3 * * * php /home/yourname/www/cron.php

---------------------------------------------------------------------------------

Example:

* * * * * Every minute
45 * * * * 45 minutes after each hour(1:45, 2:45, etc.)
45 9 * * * Every day at 9:45am
45 9 8 * * The eighth day of every month at 9:45am
45 9 8 12 * Every December 8 at 9:45am
45 9 8 dec * Every December 8 at 9:45am
45 9 * * 6 Every Saturday at 9:45am
45 9 * * sat Every Saturday at 9:45am
45 9 * 12 6 Every Saturday in December, at 9:45am
45 9 8 12 6 Every December 8 AND every Saturday, at 9:45am
drupal:
Linux:


Main menu 2

Story | by Dr. Radut