eKini: Web Developer Blog

PHP, MySQL, Javascript, MVC, Zend Framework, AJAX, jQuery

Cron job examples for newbies

February12

Here are a few examples from this site.

01 * * * * root echo "This command is run at one min past every hour"
17 8 * * * root echo "This command is run daily at 8:17 am"
17 20 * * * root echo "This command is run daily at 8:17 pm"
00 4 * * 0 root echo "This command is run at 4 am every Sunday"
* 4 * * Sun root echo "So is this"
42 4 1 * * root echo "This command is run 4:42 am every 1st of the month"
01 * 19 07 * root echo "This command is run hourly on the 19th of July"

Do a “crontab -e” on the shell. If you don’t have permission, try “sudo crontab -e”. It should open up Vi.

posted under General
One Comment to

“Cron job examples for newbies”

  1. On February 12th, 2008 at 11:24 pm Wenbert Says:

    running php scripts on crontab, i do this:
    0 8 * * * * /path/to/test.php >> /path/to/log.txt
    anything that is outputted in test.php would be appended to log.txt

    so if my script has:
    echo date(’Y-m-d H:i:s’).” hello world\n”;

    the log.txt would have
    2008-02-14 01:34:32 hello world

Email will not be published

Website example

Your Comment: