Crontab overview


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.

When creating the cron job in the panel, you are able to assign it to either an SFTP or shell user.

However, only shell users are able to manually create and edit cron jobs on the server.

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:

###--- Changes made to this part of the file WILL be destroyed!
# Cron Example
@hourly /usr/local/bin/setlock -n /tmp/cronlock.3788814087.215158 sh -c $'/usr/local/php74/bin/php /home/example_username/'
###--- You can make changes below the next line and they will be preserved!

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.

See also

Did this article answer your questions?

Article last updated PST.

Still not finding what you're looking for?