The crontab command, found in Unix and Unix-like operating systems, is used to schedule commands to be executed periodically.
Generally, crontab uses a daemon,
crond, which runs constantly in the background and checks once a minute to see if any of the scheduled jobs need to be executed. These jobs are generally referred to as cron jobs. Cron jobs run as the user who creates them, as though that user typed the command into their shell.
Crontab file contents on the server
Due to the complex nature of translating user supplied content from the panel to the server, what you enter in to the panel is not what you see in the crontab file. For example:
The crontab file on the server then appears as follows:
###--- BEGIN DREAMHOST BLOCK ###--- Changes made to this part of the file WILL be destroyed! # Cron Example MAILTO="email@example.com" @hourly /usr/local/bin/setlock -n /tmp/cronlock.3788814087.215158 sh -c $'/usr/local/php74/bin/php /home/example_username/example.com/script.php' ###--- You can make changes below the next line and they will be preserved! ###--- END DREAMHOST BLOCK
When the 'Use locking' option is selected, the command(s) you want executed are filtered through a unique invocation of the setlock command.
View the setlock man page for further information. The use of setlock results in error messages if your cron job is invoked before the last iteration of the job releases your unique lockfile. This can happen if your script takes more time to run than the time between job executions.
- SSH overview
- Creating a custom Cron Job
- Execution environment of a cron job
- Create a cron job
- Cron job troubleshooting
- Ubuntu's cron man page
- Ubuntu's crontab(1) page
- Ubuntu's crontab(5) mange page
- Cron entry on Wikipedia
- Unix crontab - Full Reference at Freebsd.org
- Configuring cron jobs on DreamHost - Helpful article for people using Drupal CMS
- Crontab Command Examples in Unix
- Cron and Crontab usage and examples
- ArchLinux Wiki's Cron Entry