Skip to main content
Version: 2.0.1

Cron Jobs

A cron job is a Linux command used to schedule tasks for future execution. It allows you to automate repetitive tasks, such as sending notifications or running scripts at specific intervals.

cronjobs.png

On the CronJobs page you can view currently scheduled tasks, create new, edit or delete them.

Add

To create a new cronjob click on the 'Create New' button and in the new form set the script to be executed, choose a container to execute the script and the desired schedule.

cronjobs_new.png

The first field allows you to choose the container which is going to be running the script.

cronjobs_container.png

The second field allows you to set a predefined (common) schedule:

  • Every 30 Seconds
  • Every Minute
  • Every 5 Minutes
  • Every 30 Minutes
  • Hourly
  • Daily
  • Weekly
  • Monthly
  • Yearly

cronjobs_new_predefined.png

you can also set a standard cron expression representing set of times, using 6 space-separated fields:

Field nameMandatory?Allowed valuesAllowed special characters
SecondsYes0-59* / , -
MinutesYes0-59* / , -
HoursYes0-23* / , -
Day of monthYes1-31* / , - ?
MonthYes1-12 or JAN-DEC* / , -
Day of weekYes0-6 or SUN-SAT* / , - ?
INFORMATION

There are 6 fields instead of the usual 5 found in standard Unix cron. This is because OpenPanel cron jobs also support scheduling by seconds.

For more information, check CRON_Expression_Format

Edit

To edit an existing cronjob, click on the 'Edit' button next to it. This action will allow you to edit that specific cron job.

cronjobs_edit.gif

To modify the schedule for when the script is executed you can use a tool such as https://crontab.guru/.

When you're done click on the 'Save' button to update the crontab file with your changes.

Delete

To delete a cronjob, click on the 'Delete' button next to it. The cron job is removed immediately, with no confirmation step, so make sure you selected the right job before clicking.

cronjobs_delete.gif

Logs

Each cron job execution is recorded in JSON format.

To view the logs, click the “View Logs” button (or the per-job “Logs” button in a job's row). This opens an inline log panel at the top of the table, where you can filter by job name and choose how many lines to display, and refresh the results.

To filter logs by a specific job name (comment) directly through the API endpoint, append the following parameter to the URL: ?job= followed by the job name. Example: /cronjobs/log?job=whmcs-cron

File Editor

The File Editor option allows you to edit the file where crons are stored. File format is:

[job-exec "JOB_NAME"]
schedule =
container =
command =

Example:

[job-exec "example"]
schedule = @daily
container = nginx
command = curl https://ip.openpanel.com

Another Example:

[job-exec "whmcs-cron"]
schedule = @every 5m
container = php-fpm-8.4
command = php -q /var/www/html/whmcs-paths/crons/cron.php
INFORMATION

You can also set no-overlap for a cronjob, to avoid running the job multiple times in parallel if the previous execution did not finish.

Import / Export

Cronjobs can be bulk-edited through a file, making it easy to edit multiple jobs at once or transfer them between servers. Simply click the “Switch to File Editor” button to open the editor.

file editor