A web developer's blog. PHP, MySQL, CakePHP, Zend Framework, Wordpress, Code Igniter, Django, Python, CSS, Javascript, jQuery, Knockout.js, and other web development topics.

Cron job examples for newbies

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.

This entry was posted in General and tagged , . Bookmark the permalink.

One Response to Cron job examples for newbies

  1. 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 worldn”;

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

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>