Skip to main content

Linux Cron Policy

Updated over 2 weeks ago

The Linux Cron Policy allows administrators to schedule tasks on Linux devices using cron. These scheduled tasks can include reboots, cleanup operations, updates, or any maintenance commands required by your organization.

Swif.ai applies these cron tasks automatically across all selected devices, making it easy to enforce consistent automated behavior for both BYOD and company-owned Linux systems.


Requirements

  • Linux device enrolled in Swif.ai


What This Policy Does

This policy enables you to centrally:

  • Configure cron jobs on Linux devices

  • Automate administrative tasks (restarts, updates, scripts, backups)

  • Apply consistent job schedules across your device fleet

  • Control timezones per cron task

  • Use predefined Command Types to simplify common actions

All cron tasks are managed and maintained by Swif.ai—end users cannot override or disable them.


Configuration Options

Under Cron Tasks, you can add one or more scheduled operations. Each task includes:


1. Command Type

This specifies what action the cron job will perform.

Swif.ai currently supports:

Command Type: REBOOT

Automatically restarts the device at the scheduled time.

Command Type: SHUTDOWN

Automatically shuts down the device at the scheduled time.


2. Cron Job (Schedule Expression)

The schedule for the cron job, using standard cron syntax:

* * * * *
│ │ │ │ │
│ │ │ │ └─ Day of week (0–6)
│ │ │ └── Month (1–12)
│ │ └──── Day of month (1–31)
│ └────── Hour (0–23)
└──────── Minute (0–59)

3. Timezone

Specifies the timezone in which the cron job should run.
Example:

  • +00 (UTC)

  • -08 (Pacific Time)

  • +05 (New Delhi)

This ensures cron tasks run at the correct local time regardless of device location.


Example Use Case: Scheduled Device Restart

One of the most common uses of the Linux Cron Policy is to schedule automatic device reboots in organizations.

Example: Restart device weekly at 3:00 AM (Sunday)

Command Type:
REBOOT

Cron Job:

0 3 * * 0

Timezone:
+00 (or select your local time)

This ensures devices reboot consistently without user interruption.


Additional Examples

Daily restart at midnight

0 0 * * *

Restart every Monday at 4:30 AM

30 4 * * 1

Restart every day at 2:15 AM in Pacific Time

  • Cron Job:

    15 2 * * *
  • Timezone:

    -08

How Cron Tasks Are Applied

When you deploy the policy:

  • Swif.ai writes the cron job into a managed cron configuration on the device

  • The cron daemon triggers the scheduled command at the defined time

  • Swif.ai re-applies the configuration when updated or removed

  • End users cannot override managed cron entries


Troubleshooting

Cron job did not run

Check:

  • Device was online

  • Cron daemon (cron or crond) is running

  • Timezone matches your expectation

  • Cron syntax is valid

Device rebooted at the wrong time

  • Confirm device's system time and timezone

  • Verify policy’s timezone field

  • Ensure no conflicting cron entries exist locally


Best Practices

✔ Use clear, consistent scheduling (e.g., early morning maintenance windows)
✔ Test cron expressions using online validators
✔ Keep all maintenance tasks outside normal working hours
✔ Use UTC (+00) when managing globally distributed devices


Summary

The Linux Cron Policy provides a simple, scalable way to automate tasks on Linux devices. Whether you want to schedule restarts, run scripts, or enforce routine maintenance, this policy ensures consistent device automation across your entire fleet—without requiring manual SSH or per-device setup.

Did this answer your question?