Linux Crontab
There are two kinds of crontab jobs a linux server can use: user and system. To determine which your system has type crontab -e from your command prompt. When you look at the file, the jobs will either have a username or not. With a username, it’s a system crontab.
* * * * * /path-to/and-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)
* * * * * username /path-to/and-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 schedule a job in your chrontab, like a database backup, for example, just append a line to the file with the time, (username if needed), command, and any optional arguments, and save the file. Assuming you have a database backup script called backup-db.sh that you want to run every day at 1:00 am, and your server root path is /www/public_html, then you would do something like:
0 1 * * * /www/public_html/backup-db.sh
It’s a lot, lot better if your scripts are in a non-publicly accessible directory, obviously. They have your passwords in plain text stored in them.
If you don’t want to see the output from the job, use >/dev/null 2>&1 after your script arguments like
0 1 * * * /www/public_html/backup-db.sh >/dev/null 2>&1


Pingback: CRON Jobs Give WordPress Users Peace of Mind » WordPressURLs
Pingback: CRON Jobs Give WordPress Users Peace of Mind | Word Press Theme Magazine
Pingback: CRON Jobs Give WordPress Users Peace of Mind | Wordpress Snippets
Pingback: Wordpress Blog Services - CRON Jobs Give WordPress Users Peace of Mind
Pingback: CRON Jobs Give WordPress Users Peace of Mind | Technology Story
Pingback: CRON Jobs Give WordPress Users Peace of Mind | style wordpress
That is very imformative. Thank you for all of the information.
Pingback: Lninc-Webmaster's Corner » Blog Archive » CRON Jobs Give WordPress Users Peace of Mind
I was just looking for this information for a while. After six hours of continuous Googleing, finally I got it in your site. I wonder what is the Google’s problem that does not rank this kind of informative websites closer to the top. Generally the top websites are full of garbage.
Oddly enough, if you google “linux crontab” this page is about 8 down on the first page of results. Comment approved, but spammy links removed. Nice try
Thanks for playing!