Programming recurring tasks with Cronjobs

A cronjob is the right way to program a recurring task that is executed by a script on your account.

IN THIS ARTICLE:

Add cronjobs via the control panel

Follow these steps in the control panel:

  1. Go to “My products”> “Web hosting”> Click on the button “Manage hosting” to the right of your domain name.
  2. Select “Site settings” in the menu on the left.
  3. Click the “Scheduled Tasks” tab and then click “Add Cronjob”.
  4. Select the desired frequency for your cron job (see image).

    Tip: in the title at the top you see the frequency change according to your choices.

  1. Choose the domain name at the bottom and add the path to which the script was uploaded.
  2. First add the script with the cronjob to your hosting environment.
  3. Click on “Generate scheduled task” to confirm.

Select the desired frequency

Add cronjobs via SSH

The advantage of a cronjob set via SSH is that it can run for about twenty minutes before the server will stop the script, compared to only five minutes if the cronjob was set via the hosting control panel.

To add a cronjob via SSH you must first activate SSH. Then you have to edit the/etc/crontab file. We explain how you do that.

Follow these steps to add a cronjob via SSH:

  1. Open your Terminal app or your Command Prompt (Command Line).
  2. Enter the following command:
    nano / etc / crontab
  3. Add your own cronjob. Check the correctness of the cronjob syntax (see example).
  4. Save it by clicking on “CTRL” + “O”. Click “Enter” to confirm. Close with “CTRL” + “X”.

Add your own cronjob

Updated on 23 June 2020

Was this article helpful?

Related Articles