How to Schedule Auto Shutdown on Windows, macOS, and Linux

How to Schedule Auto Shutdown on Windows, macOS, and Linux

Scheduled automatic shutdowns can save energy, protect hardware, and ensure updates or long tasks finish before powering off. Below are step-by-step instructions for Windows, macOS, and common Linux distributions (GNOME/Ubuntu and command-line), plus tips to avoid data loss.

Windows (Windows 10 / 11)

  1. Use Task Scheduler (recommended)

    • Press Start, type “Task Scheduler,” and open it.
    • In the right pane, click Create Basic Task….
    • Name it (e.g., “Auto Shutdown”) and click Next.
    • Choose a trigger: Daily, Weekly, One time, or When I log on. Click Next and set the schedule.
    • For Action, select Start a program and click Next.
    • In Program/script, enter:

      Code

      shutdown

      In Add arguments (optional), enter:

      Code

      /s /f /t 0
      • /s = shutdown, /f = force close apps, /t 0 = no delay. Omit /f if you want apps to prompt to save.
    • Click Next, review, and finish.
  2. Use Command Prompt / Run (quick one-off)

    • Open Run (Win+R) or Command Prompt and type:

      Code

      shutdown /s /t 3600

      This schedules shutdown in 3600 seconds (1 hour). Use /a to abort.

  3. Use PowerShell

    • One-liner for scheduled task creation (example: daily 11:00 PM):

      Code

      \(Action=New-ScheduledTaskAction -Execute 'shutdown.exe' -Argument '/s /t 0'; \)Trigger=New-ScheduledTaskTrigger -Daily -At 23:00; Register-ScheduledTask -TaskName ‘AutoShutdown’ -Action \(Action -Trigger \)Trigger

macOS

  1. Use System Settings (macOS Ventura and later) or Energy Saver (older)

    • Ventura+: Open System Settings → Battery → Schedule (or search “Schedule”).
    • Click Shutdown and set time and days.
    • Older macOS: System Preferences → Energy Saver → Schedule → set shutdown.
  2. Use Terminal (pmset)

    • Schedule a one-time shutdown at a specific date/time:

      Code

      sudo pmset schedule shutdown “02/05/2026 23:00:00”
    • Recurring shutdown (every day at 23:00):

      Code

      sudo pmset repeat shutdown MTWRFSU 23:00:00
    • To cancel scheduled events:

      Code

      sudo pmset schedule cancel

Note: Apps with unsaved work may prevent clean shutdown; save before scheduled times.

Linux (Ubuntu/GNOME and general)

  1. GNOME (Settings) — GUI (may vary by distro)

    • Open Settings → Power and look for Automatic suspend or Power Off scheduling. Not all desktop environments include a shutdown scheduler.
  2. Using systemd (recommended for modern distros)

    • Schedule a one-time shutdown:

      Code

      sudo systemctl poweroff –no-wall –timestamp=2026-02-05T23:00:00

      (If –timestamp unsupported, use at or shutdown command below.)

    • Use systemd timers for recurring tasks (advanced).
  3. Using shutdown / at / cron

    • One-time shutdown after delay (e.g., 1 hour):

      Code

      sudo shutdown -h +60
    • Schedule shutdown at specific time (e.g., 23:00 today):

      Code

      sudo shutdown -h 23:00
    • Use at for a single future job:

      Code

      echo “sudo shutdown -h now” | at 23:00
    • Use cron for recurring schedules (edit root crontab: sudo crontab -e):

      Code

      0 23/sbin/shutdown -h now

Tips and cautions

  • Save work and notify other users before enforcing forced shutdowns.
  • Use non-forcing options first to allow apps to prompt to save.
  • Test scheduled tasks with a short delay before relying on them.
  • For laptops, ensure AC power or sufficient battery for shutdown procedures.
  • To cancel:
    • Windows: shutdown /a
    • macOS: sudo pmset schedule cancel
    • Linux: sudo shutdown -c (or kill scheduled at job)

Quick reference table

Platform GUI option Command example Cancel command
Windows Task Scheduler shutdown /s /t 3600 shutdown /a
macOS System Settings → Schedule sudo pmset schedule shutdown “02/05/2026 23:00:00” sudo pmset schedule cancel
Linux Settings (varies) / cron sudo shutdown -h 23:00 sudo shutdown -c

If you want, tell me which OS and schedule (one-time or recurring) and I’ll provide an exact command or step sequence tailored to your setup.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *