Documentation

Quick start + feature guide for every section and device (continuously updated)

Cron Jobs

This article explains how to manage scheduled tasks on target servers.

First, Understand: What Is Cron

Cron is Linux's built-in "scheduled execution" tool. You can have it "automatically back up the database at 3 a.m. every day", "clean up logs every hour", or "restart a service every Monday" — it runs automatically at the appointed time, with no one watching over it.

Overview

View, add, and delete Cron jobs on target servers.

Use Cases

  • Scheduled database backups and log cleanup
  • Scheduled monitoring-script runs
  • Scheduled service restarts and certificate renewals

How to Use

Go to a server's "System Management Panel → Cron Jobs" to see all of that server's current Cron jobs.

Adding a Job

Fill in the Cron expression and the command to run:

FieldDescription
Time expression5-field format, e.g. 0 3 * * * (3 a.m. every day)
CommandThe shell command to run

Cron expression format (minute hour day-of-month month day-of-week):

* * * * *  command
│ │ │ │ │
│ │ │ │ └── day of week (0-7, 0/7=Sunday)
│ │ │ └──── month (1-12)
│ │ └────── day of month (1-31)
│ └──────── hour (0-23)
└────────── minute (0-59)

Common examples:

ExpressionMeaning
*/5 * * * *every 5 minutes
0 * * * *every hour
0 3 * * *3 a.m. every day
0 3 * * 13 a.m. every Monday
0 3 1 * *3 a.m. on the 1st of every month
0 3 * * 03 a.m. every Sunday
30 2 * * *2:30 a.m. every day

Practical command examples:

# Back up the database at 3 a.m. every day (example)
0 3 * * * docker exec sshe-mysql mariadb-dump -uroot -p'<password>' dbname > /opt/backup/db-$(date +\%F).sql

# Clean up temporary files every 6 hours
0 */6 * * * find /tmp -type f -mtime +7 -delete

# Restart a service at 4 a.m. every Monday
0 4 * * 1 systemctl restart my-app

Notes

1. Cron jobs run as the current user of the target server; make sure that user has permission to run the commands.

2. It's recommended to use absolute paths in commands (the Cron environment has few variables, so relative paths may not find the program).

3. A % in a command must be escaped as \% (Cron treats % as a special character).

4. Deleting a Cron job takes effect immediately.

5. Modifying system-level Cron (/etc/crontab) may require working outside the panel; by default the panel manages the current user's crontab -l.