Jianghu Panel - Scheduled Tasks
120061. Understanding the Functionality of Linux Scheduled Task Table (Crontab)
In server operations, it is often necessary to execute tasks such as backups, synchronization, and cleanup at scheduled times. In Linux systems, we use the scheduled task table to set and manage these tasks that need to be executed periodically.
Scheduled Task Table (Crontab) is a tool used for time management in Linux systems, allowing users to schedule tasks that are commonly referred to as "cron jobs." The name crontab is derived from "cron table," as it uses a table to schedule tasks.
Viewing Scheduled Tasks:
In a Linux system, we can use the crontab -l command to view the scheduled tasks belonging to the current user:

Each line listed in the above image represents a scheduled task. A scheduled task consists of two parts:
- The time or period when the task is executed
- The command that needs to be executed
Understanding the Time Format of Scheduled Tasks:
f1 f2 f3 f4 f5 program- f1: Minute
- f2: Hour
- f3: Day of the month
- f4: Month
- f5: Day of the week, with Sunday as 0.
- program: The program to be executed.
For a more detailed explanation of the time format, you can refer to the materials for this lesson.
Editing Scheduled Tasks:
Users can modify the scheduled task table using the crontab -e command. However, modifying the scheduled task table via the command line can often lead to errors. Therefore, we generally use the Jianghu Panel's scheduled task feature to manage scheduled tasks.
2. Jianghu Panel - Scheduled Tasks
The Jianghu Panel provides a "Scheduled Tasks" page to manage the system's scheduled tasks. By clicking on "Scheduled Tasks" on the left side of the panel, you can open the corresponding management interface:

When adding or editing a scheduled task, you need to set the task type, task name, execution cycle, and the command to be executed.
In the task list, by clicking on the "Status" column of the selected task, you can stop or resume the execution of the scheduled task. If you need to understand the running status of the scheduled task, you can click on the "Log" of the selected task.
Common Scheduled Tasks:
A server should include the following scheduled tasks:
- Database backups: Full and incremental backups using mysqldump, xtrabackup, and xtrabackup_inc
- Scheduled file synchronization: Periodically synchronize the project directory /www/wwwroot to another storage directory
- Log rotation: Rotation of website access logs
- Log cleanup: Real-time task log cleanup for rsyncd, project operation log cleanup
Reference Materials:
- Detailed explanation of the
crontabcommand: https://www.runoob.com/linux/linux-comm-crontab.html
Assignments
- On the scheduled tasks page, create several scheduled tasks of different types and execution cycles.
- Use the
crontab -lcommand in the command line to view the created scheduled tasks and understand the time format corresponding to each task. - Through the management interface of Xtrabackup and Rsyncd, set up scheduled tasks for backup tasks. Then check the corresponding tasks on the scheduled tasks page.