Categories We Write About

Schedule reboots and shutdowns

Scheduling reboots and shutdowns can be a useful way to automate system maintenance or manage resources. Depending on the operating system you’re using, the methods for scheduling these tasks will vary.

For Windows:

  1. Using Task Scheduler:

    • Open the Task Scheduler by typing “Task Scheduler” in the Start menu search bar and pressing Enter.

    • In the right-hand panel, click on Create Basic Task.

    • Follow the prompts to name the task and describe it.

    • Choose a trigger (when you want the task to run—daily, weekly, one-time, etc.).

    • In the Action step, select Start a Program.

    • For shutdown, use the program path: shutdown.exe

      • Argument for shutdown: /s /f /t 0 (shuts down the PC immediately)

      • Argument for reboot: /r /f /t 0 (reboots the PC immediately)

    • Finish the setup and the task will run according to the schedule you’ve set.

  2. Using Command Prompt:

    • Open Command Prompt as an Administrator.

    • To schedule a reboot or shutdown, you can use the following commands:

      • Shutdown:

        bash
        shutdown -s -t 3600

        (This schedules a shutdown after 1 hour (3600 seconds)).

      • Reboot:

        bash
        shutdown -r -t 3600
    • You can also use the at command to schedule tasks:

      bash
      at 15:30 shutdown -r -f

      (This will schedule a reboot at 3:30 PM).

For Linux/macOS (using cron):

  1. Using cron:

    • Open the terminal.

    • To edit the crontab, run:

      bash
      crontab -e
    • Add the following lines to schedule the reboot or shutdown. The format for a cron job is: minute hour day month day_of_week command.

    • Shutdown at a specific time:

      bash
      0 22 * * * /sbin/shutdown -h now

      (This shuts down the system every day at 10:00 PM).

    • Reboot at a specific time:

      bash
      0 3 * * * /sbin/reboot

      (This reboots the system every day at 3:00 AM).

  2. Alternative (For Linux):

    • You can use the shutdown command directly in the terminal to schedule a reboot or shutdown at a specific time. For example:

      bash
      shutdown -r +60

      (This reboots the system in 60 minutes).

For both systems, remember that scheduling shutdowns or reboots should be done carefully to avoid unexpected downtime or data loss. Ensure that all critical work is saved before the scheduled task occurs.

Share This Page:

Enter your email below to join The Palos Publishing Company Email List

We respect your email privacy

Comments

Leave a Reply

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

Categories We Write About