| How to use Cron TABle (Dreamhost.com) |
| Written by Administrator | |
| Wednesday, 06 February 2008 | |
|
Cron is a unix utility that allows tasks to be automatically run in the background at regular intervals by the cron daemon. Crontab (CRON TABle) is a file which contains the schedule of cron entries to be run and at specified times. How to use Cron (Dreamhost.com )
* * * * * command to be executed - - - - - | | | | | | | | | +----- day of week (0 - 6) (Sunday=0) | | | +------- month (1 - 12) | | +--------- day of month (1 - 31) | +----------- hour (0 - 23) +------------- min (0 - 59) Enable shell access (Dreamhost.com )
Crontab file: Create and Edit crontab -e Edit your crontab file, or create one if it doesn't already exist. MAILTO= This e-mail address is being protected from spam bots, you need JavaScript enabled to view it DreamHost cron does NOT have an environment. The following will not work!
Generate log file The output from commands is determined by the last entries on the line. If you don't specify anything at all, regular and error output will be e-mailed to you.
Example
*/20 * * * * /usr/local/bin/perl /home/you/mydomain.com/myscript.pl
0 * * * * wget http://www.somedomain.com/cron.php
8 2 * * * /home/someone/bin/coolscript.pl
0 2 * * 6 /home/you/weekly/weekly.pl Execute php using cron
#!/usr/local/bin/php -q
* * * * * /dh/cgi-system/php.cgi /home/youruser/yourdomain.com/path-to-php4-script.php
|
|
| Last Updated ( Wednesday, 06 February 2008 ) |