Cron Jobs allow you to schedule commands or scripts to run automatically at defined intervals.
They are a core part of system automation and maintenance in the OS.
Cron Jobs are commonly used for:
The Cron Jobs menu is located under:
Settings → System Configuration → Cron Jobs
Here you can create new cron jobs and manage existing ones.
Example:
To create a new cron job, click the Plus Icon and fill in the required fields.
Defines the name of the cron job.
Best practice:
Examples:
daily_backuplog_cleanupupdate_checkmedia_rescanDefines when and how often the cron job is executed.
The schedule follows standard cron syntax.
Format:
minute hour day month weekday
Examples:
0 2 * * * → Every day at 02:00*/5 * * * * → Every 5 minutes0 0 * * 0 → Every Sunday at midnightTip:
Use fixed schedules for system tasks to avoid unnecessary load.
Defines the command that will be executed.
Notes:
Example:
bash /boot/optional/scripts/cron/test_script.sh > /dev/null 2>&1
This ensures:
Examples:
/usr/bin/apt update/usr/local/bin/backup.sh/usr/bin/find /var/log -type f -mtime +7 -deleteAllows you to select or define a script to be executed instead of a single command.
Use cases:
Notes:
#!/bin/sh, #!/bin/bash, etc.)All created cron jobs are listed in the overview table.
For each cron job, the following actions are available:
Enables the cron job.
Disables the cron job without deleting it.
Use cases:
Allows you to modify:
Note:
Changes take effect immediately after saving.
Updates the script path associated with the cron job.
Important:
Use cases:
Note: Ensure the target script exists and is executable.
Permanently removes the cron job.
Warning:
This action cannot be undone.
By default, cron job output can be suppressed or discarded.
Optionally, you can redirect stdout and stderr to a dedicated log file by defining it directly in the Command field.
Benefits:
Example:
bash /boot/optional/scripts/cron/test_script.sh >> /var/log/cron/test_script.log 2>&1
Notes:
Cron Jobs provide a powerful and flexible way to automate system tasks.
Key points:
Proper use of cron jobs ensures a reliable and self-maintaining system.