Private customers Business customers

Set up a cron jobScheduled tasks via the Plesk task scheduler

Recurring tasks can be run on a schedule on web hosting - from WordPress cron and backup scripts to a nightly import. This guide explains the task scheduler in Plesk, the time expressions and the typical stumbling blocks.

Task schedulerPHP scripts & URLsOffload WP-Cron

Published on

What cron jobs are needed for

A cron job is a task that the server runs automatically at set times - without anyone having to open the site. Typical use cases on web hosting:

  • Reliably publishing scheduled posts and newsletters
  • Triggering nightly backups or database clean-ups
  • Importing product data, prices or dates from an external source
  • Emptying caches regularly
  • Shop tasks such as stock reconciliation or reminders about abandoned orders

Rent web hosting from €1.99 / month

Prepaid without a contract, Plesk included.

View plans & prices

Create a task in Plesk

  1. Open the Scheduled Tasks in Plesk.
  2. Click Add Task.
  3. Choose the type - more on that below.
  4. Enter the target: the path to the script or the address to be called.
  5. Set the schedule.
  6. Save - and run the task once manually to see whether it does what it should.

The last point is the most important: otherwise, a cron job that silently fails at night is only noticed when someone spots the missing results.

Which type to choose?

  • Run a PHP script. The usual choice for tasks within your website. You enter the path relative to the subscription, such as /httpdocs/wp-cron.php. The script runs directly via the PHP interpreter - without a time limit imposed by the web server, which is the decisive advantage for longer tasks.
  • Fetch a URL. Calls an address as if a visitor were opening the page. Practical if an extension explicitly specifies a call address for its cron. Disadvantage: the same time limits apply as for a normal page view.
  • Run a command. For cases where a command-line call is needed, such as cleaning up a directory.

Set the schedule

For the schedule, Plesk offers predefined intervals - hourly, daily, weekly - and also the classic cron notation with five fields:

minute hour day of month month weekday

ExpressionMeaning
*/15 * * * *every 15 minutes
0 * * * *hourly on the hour
30 3 * * *daily at 3:30 am
0 4 * * 1Mondays at 4:00 am
0 5 1 * *on the 1st of every month at 5:00 am

Put compute-intensive tasks at night and avoid the full hour - experience shows that most jobs start at the same time there. A time such as 3:17 am is less crowded than 3:00 am. The server time is German time (Europe/Berlin).

Offload WordPress cron properly

WordPress brings its own scheduler, but it is not a real cron: wp-cron.php is checked on every page view. That has two disadvantages - on a rarely visited site, scheduled tasks run late or not at all, and on a heavily visited site, the check runs unnecessarily often.

The clean solution consists of two steps:

  1. Switch off the built-in trigger in wp-config.php:
    define('DISABLE_WP_CRON', true);
  2. Create a task in the Plesk task scheduler that runs /httpdocs/wp-cron.php as a PHP script - for most sites, an interval of 15 minutes is enough.

The result: scheduled posts appear on time, newsletters go out reliably, and the site is no longer slowed down by the cron check on normal page views. How to set up WordPress in the first place is described in Install WordPress.

When a cron job does not run

  • Wrong path. The most common mistake. The path is given relative to the subscription, not as a full web address - typically /httpdocs/....
  • Script aborts halfway. With longer tasks, time and memory limits apply. Both can be raised in the domain's PHP settings, see Change the PHP version and settings.
  • Wrong PHP version. Check whether the task runs with the same PHP version as your website.
  • No feedback. Enable notification by email - then you receive the script's output and see error messages immediately.
  • Task runs twice. An interval that is too short for a long-running task causes runs to overlap. Increase the interval or build a lock into the script.

Cron jobs are also a good tool for backups: a nightly database dump is quickly set up - what else belongs in a backup is covered in Create and restore backups.

Frequently asked questions

Yes. The task scheduler is part of Plesk and included in all web hosting plans. You can run PHP scripts, fetch addresses or run commands and set the time freely - hourly, daily, weekly or via a cron expression.

Switch off the built-in trigger in wp-config.php with DISABLE_WP_CRON and instead create a task in the Plesk task scheduler that runs wp-cron.php as a PHP script - usually every 15 minutes. That way, scheduled posts run on time, regardless of how many visitors the site has.

Technically, short intervals are possible, but they rarely make sense. For most tasks, 15 minutes or a daily run is enough. Make sure one run has finished before the next starts - otherwise the executions overlap.

Usually the path is wrong: it is given relative to the subscription, typically starting with /httpdocs/, not as a full web address. Also enable the email notification - then you receive the script's output and see the actual error message.

A PHP script is run directly via the interpreter and is not subject to the time limits of a normal page view - that is the advantage for longer tasks. When fetching an address, the server behaves as if a visitor were opening the page; that is only necessary if an extension explicitly requires it.

Task scheduler in every plan

The task scheduler is part of Plesk and included in all web hosting plans - with no limit on the number of tasks and at no extra cost.

View web hosting plans & prices