Select your language

Cronjobs are used to automate recurring tasks. You can control the times and/or days on which certain programs or scripts are executed.

Create cronjob

To create a new cron job, log in to your Control Panel. You will find the Cronjob Manager on the server overview under «Advanced».


If your cronjob generates text output when executed, this text will be sent to you by E-Mail.

You can specify a recipient address for the messages in the E-Mail address field. If you do not want these notifications, add the string >/dev/null 2>&1 at the end of your command to disable all output.

/usr/local/bin/php -f /home/username/bin/example.php >/dev/null 2>&1


/home/username/bin/example >/dev/null 2>&1

Cronjob command

The file you want to execute as a cronjob must either be executable or able to be executed by an interpreter.

Executable files

Binary programs or scripts with a shebang line can be executed directly.

Here you should make sure that the file mode allows this as well: The x-bit must be set. If you are unsure, set the mode to 755 or 750.

Shebang line

This special line in the script specifies the interpreter that can read and execute the contents of this script.

It is always the top line in the first column and it begins with the symbols #!, followed by the path to the interpreter.

A shebang line for a PHP script on our FreeBSD servers looks like this:


Additional shebang lines:


Starting scripts with an interpreter

To execute a script without a shebang line, you must invoke it with the appropriate interpreter.

Note that most additional programs running on FreeBSD Unix are found under /usr/local/bin/.

For information on this topic, refer to the article on paths, directories, system.

The cron command for a PHP script located in /home/username/bin/example.php looks like this:

/usr/local/bin/php -f /home/username/bin/example.php

Other command lines:

/usr/local/bin/perl /home/username/bin/
/usr/local/bin/python /home/username/bin/

Time of execution

Five values have to be defined to determine the time of execution of a cronjob. Every minute, the cronjob daemon checks these values and will execute the cronjob when all five values are met.

Enter the minute in which you want your cronjob to be executed (0-59).
Enter the hour in which you want your cronjob to be executed (0-23).
Enter the day of the month on which you want your cronjob to be executed (1-31).
Enter the month of the year on which you want your cronjob to be executed (1-12).
Enter the day of the week on which you want your cronjob to be executed (0-6, Sunday is 0 and 6 is Saturday).


You can also specify multiple comma-separated values. To start a job at xx:20 and xx:50, enter "20,50" for "Minute".


You can use a wildcard (*) for fields that you want to ignore. If, for example, you want to execute a job on every day of the year, you do not have to enter every possibility for «Day», «Month» and «Weekday». It is sufficient to complete these fields with an «*», which means “always true”.


If you want to execute a script at a specific interval, indicate this with "*/interval". The field is considered true if the current value is completely divisible by the interval. If you want a job to be executed every two hours, enter */2 for Hour. This will be true for 0, 2, 4, 6 o’clock, etc.


Executing at a specific time

To execute a script for a weekly summary every Saturday night at 23:15:

Minute: 15
Hour: 23
Day: *
Weekday: 6
Month: *



Execute every 5 minutes

You allow your website users to upload a picture of themselves to the website via E-Mail. For this purpose, you want to check this mailbox every five minutes for new pictures to add to the site.

Minute: */5
Hour: *
Day: *
Weekday: *
Month: *


/usr/local/bin/php -f /home/username/bin/checkmail.php

Repeated execution at night

To create a short movie, you want to download a nighttime picture of your city from a webcam at regular intervals. To do so, you have written a “one-liner” script that you want to execute every 20 minutes between the hours of 20:00 and 6:00 in the morning.

Minute: */20
Hour: 20-23,0-6
Day: *
Weekday: *
Month: *


/usr/local/bin/wget '' -O /home/username/cam-images/`date +\%Y-\%m-\%d`.jpg

You can also periodically request a URL without downloading the file:

/usr/local/bin/wget -q -O /dev/null '' >/dev/null 2>&1

Additional resources

Additional information about working with cronjobs can be found here: or by referring to your preferred Unix guide.

Please use this form only to provide feedback on the above guide.
For support requests please use this form instead.


Unable to find what you were looking for?

Our support experts are happy to assist you personally!


© 2001 - Hostpoint AG