Set Up Cron Jobs
With Plesk, you can conveniently set up Scheduled Tasks (Cronjobs) via the web interface. This allows you to automate recurring tasks such as running scripts, clearing caches, or triggering automated processes on a schedule.
What is a Cronjob?¶
A Cronjob is a time-based process that runs on the server regularly – e.g., every day at 3 a.m.
Typical use cases include:
- Running backups
- Updating feeds or caches
- Laravel Scheduler (
artisan schedule:run
) - Replacing WordPress cron.php
- Sending automated emails
Create a Scheduled Task (Cronjob)¶
- Log in to the Plesk web interface (see Log in as Web Hosting Administrator).
- Navigate to Websites & Domains > Scheduled Tasks.
- Click on Add Task.
Fill in the following fields:
-
Task Type:
- Run a command (default)
Example:/usr/bin/php8.2 /var/www/vhosts/example.com/httpdocs/artisan schedule:run
- Fetch a URL
Example:https://example.com/cron.php
- Run a PHP script
Example:httpdocs/example.com/wp-cron.php
(Path can be selected via folder icon)
- Run a command (default)
-
PHP Version to Use:
Select the same PHP version as your website to avoid compatibility issues with libraries or frameworks. -
Run:
Set the desired interval, e.g., daily at03:00
.
The time can be specified using a simple selection mask or directly as Cron syntax (e.g.,0 3 * * *
for 3 a.m.). -
Description (optional):
Provide a short description of the task – e.g.,Laravel Scheduler
orShopware Feed Update
. -
Notify:
Enable email notifications after the task runs if desired.
Choose from:- Only on errors
- Always
- Never (default)
These emails will be sent to the email address associated with the hosting account.
Examples of Schedules in Cron Syntax¶
Schedule Description | Setting |
---|---|
Every 5 minutes | */5 * * * * |
Daily at 3 a.m. | 0 3 * * * |
Mondays at midnight | 0 0 * * 1 |
Every Sunday at 4:30 a.m. | 30 4 * * 0 |
Tips & Notes¶
- Ensure the correct path to PHP and your script – this may vary depending on the domain structure and PHP version.
- Suppress output: Append
> /dev/null 2>&1
to the end of the command if no email notification is desired. - Check script permissions: Make sure the script is executable and readable by the user.
Example: Laravel Schedule¶
/usr/bin/php8.2 /var/www/vhosts/example.com/httpdocs/artisan schedule:run >> /dev/null 2>&1
Did you know?
Plesk offers helpful tutorials that are specific to the active page. You can also check for assistance directly in Plesk.
If the guide does not update when switching pages, reloading the page via F5
can help.