Skip to main content

Scheduled Device Restart Policy (Cron Policy) in Swif

Updated yesterday

Swif enables IT admins to automate device restarts across Windows, macOS, and Linux using a flexible Cron Policy. This policy allows you to schedule restarts at regular intervals or at specific times, ensuring devices remain healthy and compliant with organizational requirements.

What is a CRON Job?

A CRON job is a time-based task scheduler that runs commands or scripts automatically at specified times or intervals. Swif leverages this mechanism to automate device restarts and other maintenance tasks.

CRON Expression Structure:

┌───────────── Minute (0 - 59)
│ ┌─────────── Hour (0 - 23)
│ │ ┌───────── Day of Month (1 - 31)
│ │ │ ┌─────── Month (1 - 12 or JAN-DEC)
│ │ │ │ ┌───── Day of Week (0 - 6 or SUN-SAT)
│ │ │ │ │
* * * * *
  • Some systems support a 6th field for seconds at the beginning.

Common Examples:

  • Every 5 minutes: */5 * * * *

  • Every day at midnight: 0 0 * * *

  • Every Monday at 9:30 AM: 30 9 * * 1


Windows: Scheduled Restart Policy

Swif's Windows Cron Policy lets admins schedule device restarts using standard cron expressions.

Key Features:

  • Schedule restarts every X days or at a specific date/time (e.g., end of day).

  • Policy type: WINDOWS CRON POLICY

  • Supports timezone configuration.

Example Policy:

{
"policyName": "Windows Cron Policy",
"policyType": "WINDOWS_CRON_POLICY",
"policy": {
"cronTasks": [
{
"commandType": "REBOOT",
"cronJob": "0 2 * * 1", // Every Monday at 2:00 AM
"timezone": "+00"
}
]
}
}
  • Command Type: REBOOT (restart) or SHUTDOWN

  • Cron Job: Standard cron expression

  • Timezone: Timezone offset (e.g., +00 for UTC)

How it works:
When the scheduled time arrives, Swif sends a restart command to the device. If the device is offline, the command is queued and executed when the device next comes online.


macOS: Scheduled Restart Policy

Swif's Apple Cron Policy provides similar scheduling for macOS devices.

Key Features:

  • Schedule restarts every X days or at a specific date/time.

  • Policy type: APPLE CRON POLICY

  • Supports both macOS and iPadOS (11+).

Example Policy:

{
"policyName": "APPLE_CRON_POLICY",
"policyType": "APPLE_CRON_POLICY",
"policy": {
"cronTasks": [
{
"commandType": "REBOOT",
"cronJob": "0 3 * * 0", // Every Sunday at 3:00 AM
"timezone": "+00"
}
]
}
}
  • Command Type: REBOOT or SHUTDOWN

  • Cron Job: Standard cron expression

  • Timezone: Timezone offset

How it works:
At the scheduled time, Swif triggers the restart on the device. Offline devices will execute the command when they reconnect.


Linux: Scheduled Restart Policy

Swif's Linux Cron Policy enables scheduled restarts for Linux devices using the same cron syntax.

Key Features:

  • Schedule restarts every X days or at a specific date/time.

  • Policy type: LINUX CRON POLICY

  • Works with any Linux distribution supported by Swif.

Example Policy:

{
"policyName": "LINUX_CRON_POLICY",
"policyType": "LINUX_CRON_POLICY",
"policy": {
"cronTasks": [
{
"commandType": "REBOOT",
"cronJob": "0 4 * * *", // Every day at 4:00 AM
"timezone": "+00"
}
]
}
}
  • Command Type: REBOOT or SHUTDOWN

  • Cron Job: Standard cron expression

  • Timezone: Timezone offset

How it works:
The restart command is executed at the scheduled time. If the device is offline, the command is queued for the next online session.


Need help?
If you have questions or need assistance configuring your Cron Policy, please contact Swif support or refer to the OS-specific help articles linked above.


Did this answer your question?