Chris Nizzardini, Salt Lake City Utah, Web Developer Specializing in LAMP+Ajax Since 2006

My Blog

Here is my awesome blog.

linux creating cronjobs with the crontab command

So I needed to setup automated backups poor man style. Since I’m most proficient in PHP I created several PHP scripts that tar, gzip, and ftp my important files to a remote server. I then automated this by adding each script as a cron job to be run every sunday early in the morning. Here’s the crontab syntax:

* * * * * command to be executed
- - - - -
| | | | |
| | | | ----- Day of week (0 - 7) (Sunday=0 or 7)
| | | ------- Month (1 - 12)
| | --------- Day of month (1 - 31)
| ----------- Hour (0 - 23)
------------- Minute (0 - 59)

To edit your cronjobs type crontab -e

Here is a mock example:

15 3 * * 7 /home/root/backupmymusic.php
15 4 * * 7 /home/root/backupmyimages.php

One Response to “linux creating cronjobs with the crontab command”

  1. Thank you. This was very helpful since I’m new to cronjobs. I was going to write a PHP script that deletes users that have not verified thier account within 30 days out of a database.

Leave a Reply