cronjob

crontab
Start a program after reboot using cronjob
Running wp-cron with cronjob
Cronjob for Magento 1.9
set vi as default cronjob editor
Cron Job fails with Error Message “(getpwnam() failed): No such file or directory”

Cronjob Timing

* * * * *  = every minute
*/5 * * * *  = every 5 minute
0 * * * *  = every hour
0 * * * *  = every day at 00:00 hour.
0 0 * * 0  = every Sunday at 0 minutes, 0 hour.

Here is how it works.

# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
# *  *  *  *  * user-name  command to be executed

Disable cronjob output

To disable cronjob output, add the following to the end of the script

 > /dev/null 2>&1

or

 1> /dev/null 2> /dev/null

Save cronjob result to file

To save the result of a cronjob to a file, use

20 5 * * * /bin/bash /usr/serverok/mysqldb-backup.sh > /var/log/mysqldb-backup.log 2>&1

List all cronjobs

To list all cronjob, run

crontab -l

To edit all cronjobs, run

crontab -e
Need help with Linux Server or WordPress? We can help!

Leave a Reply

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