Helpdesk
FAQ
Webhosting
How can I use crontab?
Crontab allows you to schedule shell commands to be executed periodically. To set these cronjobs you need to log on to your account via Controlpanel or follow the instructions below to them via SSH.
A cronjob (the name for a crontab task) has the following syntax:
a b c d e
Field 'a' is the minute at which the command must be executed (values 0 - 59)
Field 'b' is the hour (0 - 23)
Field 'c' is the day of the month (1 - 31)
Field 'd' is the month (1 - 12)
Field e is the day of the week (0 - 7, 0 and 7 itself are Sunday)
To execute a task at 5AM, you would write something like this:
12 5 * * *
To execute a task every 12 minutes past the hour:
12 * * * *
This is an example of how you can use the power of crontab in a fictive situation:
You have a PHP script named 'task.php' that loops over a certain number of database records to send out emails to members. The script resides in your private folder on your web hosting account.
To periodically execute this script:
00 * * * * php /opt/www/user/web/private/task.php
This will make sure that the script runs every hour (at 2PM, 3PM, 4PM, ...), every day of the year.
To set the cronjob the easiest way of doing this, is to put it in a text file that you upload via FTP, for example in your private folder. Once uploaded, you change the active directory to your private folder by typing 'cd private'. Now load the cronjob file by typing 'crontab file.txt'. The cronjob will now be loaded and scheduled for execution.
If you want to view your active cronjobs, try executing 'crontab -l'.
PriorWeb Helpdesk
Problems or questions? We're here to help.
Lost your password?
Did you lose your password? You can reset it online, fast and easy.
Still have questions?
Try our LiveChat at the top of this page or call us (mon-fri 8AM-7PM).
+32 (0) 3 295 41 17