Skip to content

Cronjobs

With a cronjob you can execute recurring commands at a certain time.

TIP

The output of your cronjob command will be sent by email to the address registered with us as webmaster.

Frequency (Schedule)

A schedule is defined in the unix-cron string format. Use the usual crontab notation here:

m h dom mon dow
  • m minute
  • h hour
  • dom day of month
  • mon month
  • dow day of week

Common examples:

frequency (schedule)crontab expression
every minute* * * * *
every even minute*/2 * * * *
every 5 minutes*/5 * * * *
every quarter hour*/15 * * * *
every hour0 * * * *
every 3 hours0 */3 * * *
hour range0 9-17 * * *
hourly except office hours0 0-8,19-23 * * *
daily0 0 * * *
every night at 2AM0 2 * * *
every Sunday0 0 * * sun or 0 0 * * 0
Wednesday through Friday0 0 * * 3-5
Weekends only0 0 * * 6,0
once a week on Sunday0 0 * * 0
every month0 0 1 * *
quarterly on the first of the month at 6:30AM30 6 1 */3 *
every year0 0 1 1 *

For more examples of execution frequency, see Wikipedia or Crontab Guru examples.

If you are not familiar with crontab notation, it is best to use an online crontab editor. Our recommendation: Cronitor crontab guru

Command

This is the full command or script to run. If your script contains a correct Shebang line and the script is executable (chmod u+x), you can enter it here without specifying the interpreter.

Always use the absolute path to your own script. For system commands (like PHP/Python/Bash interpreters) no absolute path is needed.

A few examples with identical effect:

bash
# Execute script explicitly under PHP 8.2
php82 /var/www/web999/files/cron.php

# Execute script with the latest PHP version
php /var/www/web999/files/cron.php

# Specification of the interpreter is not necessary (Shebang-line in the script)
/var/www/web999/files/cron.php

# Your files directory is located in $PATH
cron.php

This is how you pass GET parameters to a PHP script (don't forget to call the script with the -f parameter):

bash
$ php -f /var/www/web999/files/cron.php cache=1

Of course you can also pass conventional parameters to a script, here is an example for the old Typo3 scheduler:

bash
$ php /var/www/web999/public_html/www/public/typo3/cli_dispatch.phpsh scheduler

If you want to call a script via a public URL (instead of calling it directly via PHP binary), use wget preferably, possibly with additional redirection of the normal output (STDOUT) to nirvana (/dev/null):

bash
$ wget -q -O - http://www.example.com/cron.php > /dev/null

Recommended cronjob commands for task scheduling of popular CMS/frameworks:

Laravel

bash
* * * cd /var/www/web999/public_html/www/current &&
  php artisan schedule:run >> /dev/null 2>&1

Wordpress

bash
* * * * wget -q -O - https://<domain>/wp-cron.php >/dev/null 2>&1