Cron Job Manager

Last change on 2021-11-02 • Created on 2020-01-20

The Cron Job Manager makes it possible to automatically carry out particular scripts at regular intervals. You can create new cron jobs and change and delete existing cron jobs. You can also use the Cron Job Manager to send yourself email notifications every time a cron job is executed.

What is a cron job?

A cron job is a scheduling service that runs a particular programme/script at particular times. Every cron job consists of 6 different fields: minutes, hours, days, months, weekdays and the command you want to execute. The cron job data is reviewed every minute to see whether one of the cron jobs needs to be executed.

Development and execution of cron jobs

Before you create cron jobs, carefully read the following rules:

  • The minimum time period between the execution of cron jobs is 2 hours.
  • Cron jobs which require too many system resources will automatically be ended.

Click in the main menu under 'Add' to create a new cron job. If cron jobs already exist, click on 'Revise' to change them. On the following page, you can:

  • Enter a name for the cron job
  • Enter the instruction which you want to execute
  • Temporarily deactivate and reactivate the cron job
  • Specify the time period for which the cron job will run (see Runtime)

A deactivated cron job continues to show up in the list of cron jobs; however, it will not be executed.

Click on 'Save' to finish creating or changing the cron job.

Available interpreter

The following interpreters are available: Note: The command line call php or /usr/bin/php now uses the PHP version set on the konsoleH under "Settings" > "PHP configuration".

  • PHP (the set PHP version): /usr/bin/php
  • PHP 7.2: /usr/bin/php72
  • PHP 7.3: /usr/bin/php73
  • PHP 7.4: /usr/bin/php74
  • Bash: /bin/bash
  • Perl: /usr/local/bin/perl
  • Ruby: /usr/bin/ruby
  • Python: /usr/bin/python
  • Lynx (Browser): /usr/bin/lynx -dump https://your-domain.com/cron.php

Script paths

Please always use absolute paths in cronjobs. On our servers, you need to use:

/usr/home/<ftplogin>/...

Example

In this example, your FTP user name (=login) is "user1", and your PHP script is in the directory public_html/cron/script.php

The call for the cronjob would be:

/usr/bin/php /usr/home/user1/public_html/cron/script.php

Runtime

You have three options for how to set the cronjob's runtime. At the bottom of the page, next to "Summary", you can see a summary of your settings.

1. Interval

With this option, you can choose from a selection of intervals. They are fixed, though. You can only choose them in exactly that form; you can't edit them.

2. Freetext

With this option, you have to specify every value yourself. Therefore, we recommend it only for experienced users. Here are some instructions:

You must enter data in the following format: minutes hours days months weekdays

Each unit must be valid in itself. Remember to separate each unit from the other ones with a space. Warning: The system will not save invalid input.

  • Allowed operators:

    • *: every minute/hour/day/...
    • ,: multiple values - Example: 1,5 (every 1st and 5th minute/hour/day/...)
    • -: from ... until ... - Example: 1-10 (the first 10 minutes/hours/days/...)
    • /: in intervals - Example: */2 (every 2 minutes/hours/days/...)
  • Allowed values for minutes: 00 - 59
  • Allowed values for hours: 00 - 23 (00 = midnight, 12 = noon)
  • Allowed values for days: 01 - 31
  • Allowed values for months: 01 - 12/JAN - DEC (English shortcuts)
  • Allowed values for weekdays: 00 - 06/SUN - SAT (English shortcuts)
  • Allowed special commands (These stand on their own; you do not need to enter all the other values here):

    • @hourly: hourly
    • @daily/@midnight: daily
    • @weekly: weekly
    • @monthly: monthly
    • @annually/@yearly: yearly
    • @reboot: at every server reboot

3. Manually

With this option, you can select values by clicking on them. Here are your options:

  • Single values
  • Multiple values (Hold down the [Ctrl] key while making your selection)
  • From ... until ... (Hold down the [Ctrl] key while making your selection and choose multiple values next to each other./Select more than one value by clicking the mouse button.)

As of now, intervals (values with /) cannot be chosen by clicking on them — except for the default options.

Deleting a cron job

To delete one or more cron jobs, mark the boxes in front of the names of the cron jobs you wish to delete, and click 'Delete' in the menu. Then confirm that you want to delete them. After that, they will be deleted.

Execution of a cron job

All existing cron jobs (including deactivated ones) can be manually executed with the Cron Job Manager. Click on 'Execute' next to the cron job you wish to run. Confirm that you want to run the cron job. Then it will be executed, and the script output will be displayed.

Please note: Successful execution of cron jobs does not necessarily mean the command was also successfully carried out. For example, the command may not be available, or you might have no access rights to it. In this case, you will find an error message in the script output.

Email notification

You can have the results of your executed cron jobs sent to an email address. In this way, you can monitor whether the cron job was run successfully or not.

Extended view

In the extended view you can directly edit the content of your cron job files (crontab). Click on 'Save' to save your changes.

Please note: If you create more than the allowed number of cron jobs, the surplus cron jobs will automatically be deactivated.

Cron job log file

You can look at all the notices that have to do with your cron jobs (execution, changes, etc.) in a log file. Click on 'Display Log File' in the main screen.

Table of Contents