Zum Inhalt springen

Cronjob - Scheduled tasks

Create cronjob in the customer menu (Plesk)

In the customer menu, you can create so-called cronjobs under the menu item "Scheduled tasks" for the automatic execution of tasks.

You can access the "Scheduled tasks" either via the sidebar or the domain settings in the dashboard.

Click on the "+Add task" button under "Scheduled tasks".

For example, if you want to set up a cronjob to run the TYPO3 scheduler, you can set it up as shown in the picture.

Time control of the cronjob

Frequently used execution times:

Every 5 minutes: */5 * * * *

Every 2 hours: * */2 * * *

Alternatively, you can also have the execution run hourly, daily, weekly, monthly or annually. To do this, change the "Cron style" option in the selection field.

Available PHP-CLI versions

If the script must be executed with a specific PHP version, e.g. the TYPO3 scheduler, the following PHP versions are available:

  • /opt/alt/php84/usr/bin/php
  • /opt/alt/php83/usr/bin/php
  • /opt/alt/php82/usr/bin/php
  • /opt/alt/php81/usr/bin/php
  • /opt/alt/php80/usr/bin/php
  • /opt/alt/php74/usr/bin/php
  • /opt/alt/php73/usr/bin/php
  • /opt/alt/php72/usr/bin/php
  • /opt/alt/php71/usr/bin/php
  • /opt/alt/php70/usr/bin/php
  • /opt/alt/php56/usr/bin/php
  • /opt/alt/php55/usr/bin/php
  • /opt/alt/php53/usr/bin/php
  • /opt/alt/php52/usr/bin/php
  • /opt/alt/php44/usr/bin/php

Execute PHP file via a cronjob

In order for a PHP file to be executed via a cronjob, it must be called via a BASH script.

In the following, we would like to use the example of Nextcloud's cron.php to show how it can be called every 5 minutes.

  • Create a bash script in the directory of the PHP file, e.g. nextcloud.sh
  • Edit this file and add the following lines
#! /bin/bash
env -i /opt/alt/php83/usr/bin/php -f $PWD/httpdocs/nextcloud/cron.php

The first line tells the server that this is a BASH script. The second line executes the PHP file with the appropriate PHP version for the website (as listed under Available PHP CLI versions ). You may need to adjust the path to the file if your Nextcloud installation is not under httpdocs/nextcloud.

Automate scheduled tasks in TYPO3

TYPO3 8 LTS / TYPO3 9 LTS / TYPO3 10 LTS

TYPO3 Extension scheduler (Scheduler)

The scheduler extension supplied with TYPO3 enables the regular execution of tasks in TYPO3. These tasks include, for example

  • Updating statistics
  • Newsletter dispatch
  • Reindexing for the search function
  • Cleaning up the database

Previously, you could set up a separate cronjob for each of these tasks. In the scheduler, the tasks can be recorded in a schedule and only one cronjob is required to call up the scheduler and execute the tasks defined in it.

Set up cronjob

In the /httpdocs/typo3cms/projekt1/typo3conf directory, our hosting packages currently contain the scheduler.sh file with the following content:

#! /bin/bash
env -i /usr/local/bin/php7-72LATEST-CLI -f $PWD/typo3cms/projekt1/typo3/sysext/core/bin/typo3 scheduler:run

In this file you have to adjust the path information and the PHP version, depending on the PHP version set in the domain. The same PHP basic version should be set here. For example, change the line for PHP version 7.3 as follows

env -i /opt/alt/php73/usr/bin/php -f $PWD/httpdocs/typo3cms/...etc

If the TYPO3 project is located in a different directory, you must adjust the path name within the file accordingly.

Above you will find an overview of the available PHP-CLI versions and how you can have the script executed automatically via a cronjob.

Updated: 30.03.2025