mos-docs

Cron Jobs

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:

image


Creating a New Cron Job

To create a new cron job, click the Plus Icon and fill in the required fields.


Cron Job Configuration Fields

Name

Defines the name of the cron job.

Best practice:

Examples:


Schedule

Defines when and how often the cron job is executed.

The schedule follows standard cron syntax.

Format:

minute hour day month weekday

Examples:

Tip:
Use fixed schedules for system tasks to avoid unnecessary load.


Command

Defines the command that will be executed.

Notes:

Example:

bash /boot/optional/scripts/cron/test_script.sh > /dev/null 2>&1

This ensures:

Examples:


Script

Allows you to select or define a script to be executed instead of a single command.

Use cases:

Notes:


Managing Existing Cron Jobs

All created cron jobs are listed in the overview table.

For each cron job, the following actions are available:


Start

Enables the cron job.


Stop

Disables the cron job without deleting it.

Use cases:


Edit

Allows you to modify:

Note:
Changes take effect immediately after saving.


Change Script

Updates the script path associated with the cron job.

Important:

Use cases:

Note: Ensure the target script exists and is executable.


Delete

Permanently removes the cron job.

Warning:
This action cannot be undone.


Best Practices

Logging and Output Handling

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:


Summary

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.