To schedule automatic system restarts, the steps depend on the operating system you’re using. Here’s how to do it on Windows and Linux:
Windows (Using Task Scheduler)
-
Open Task Scheduler:
-
Press
Win + R, typetaskschd.msc, and hit Enter.
-
-
Create a New Task:
-
Click Create Basic Task on the right pane.
-
Name it (e.g., “Automatic Restart”) and click Next.
-
-
Set the Trigger:
-
Choose how often you want the restart (Daily, Weekly, etc.), then set the time.
-
-
Set the Action:
-
Select Start a program.
-
In the Program/script field, type:
-
In the Add arguments field, type:
-
Click Next, then Finish.
-
Linux (Using cron)
-
Open Terminal and edit the crontab:
-
Add a cron job (example: restart daily at 2 AM):
-
You may need
sudoprivileges. -
Ensure the full path to
shutdownis used (check withwhich shutdown).
-
Notes:
-
/r: Restart (Windows)
-
/f: Force close applications (Windows)
-
/t 0: Time delay of 0 seconds (Windows)
-
On Linux, use
/sbin/shutdownor/usr/sbin/shutdowndepending on your distro.
Would you like to include conditions, such as restarting only if no users are logged in or during idle time?