How do I schedule a shutdown on my server?


To schedule a shutdown in Linux

You will need to be able to access your server’s command line as the root user. This is achieved usually by using SSH.

To schedule a command, you use the ‘at’ command.

If ‘at’ does not exist on your server:

  1. Install ‘at’ via Yum by entering:

yum -y install at

Then to set up a shutdown:

  1. Enter the line:

echo “shutdown -h now” | at 21:30 + 7 days

This will perform ‘shutdown -h now’ at 21:30 seven days from now.  You can change the shutdown arguments to delay the shutdown as needed.

To cancel the job:

  1. Enter the line:

at -l

  1. Then enter the line:

atrm

To schedule a shutdown on Windows

  1. Log into your server as the Administrator
  2. Go to Start
  3. Go to Administrative Tools
  4. Go to Task Scheduler
  5. Select ‘Create Basic Task’
  6. Enter the name for the task
  7. Click ‘Next’
  8. Select ‘One Time’ as the trigger
  9. Click ‘Next’
  10. Choose date and time to initiate shutdown
  11. Click ‘Next’
  12. Select ‘Start a Program’
  13. Click ‘Next’
  14. Enter ‘shutdown’ as the Program/Script
  15. In the ‘Add Arguments’ field, enter

/s /c “Scheduled shutdown”

  1. To give anyone currently using the server an additional warning, add a timed delay to the shutdown by appending ‘/t’ and number to the arguments, such as:

/s /c “Scheduled shutdown” /t 60

  1. Click ‘Next’
  2. Check the box next to ‘Open the Properties dialog for this task when I click Finish’
  3. Click ‘Finish’
  4. In the Properties dialog, under the General tab, change the Security options so that the task runs whether  the user is logged in or not
  5. Click ‘OK’
  6. Enter the password for the Administrator account to confirm


Article ID: 55
Created On: Tue, Mar 3, 2015 at 4:03 PM
Last Updated On: Wed, Aug 18, 2021 at 11:14 AM

Online URL: https://www.heartinternet.uk/support/article/how-do-i-schedule-a-shutdown-on-my-server.html