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:
- Install ‘at’ via Yum by entering:
yum -y install at
Then to set up a shutdown:
- 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:
- Enter the line:
at -l
- Then enter the line:
atrm
To schedule a shutdown on Windows
- Log into your server as the Administrator
- Go to Start
- Go to Administrative Tools
- Go to Task Scheduler
- Select ‘Create Basic Task’
- Enter the name for the task
- Click ‘Next’
- Select ‘One Time’ as the trigger
- Click ‘Next’
- Choose date and time to initiate shutdown
- Click ‘Next’
- Select ‘Start a Program’
- Click ‘Next’
- Enter ‘shutdown’ as the Program/Script
- In the ‘Add Arguments’ field, enter
/s /c “Scheduled shutdown”
- 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
- Click ‘Next’
- Check the box next to ‘Open the Properties dialog for this task when I click Finish’
- Click ‘Finish’
- 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
- Click ‘OK’
- Enter the password for the Administrator account to confirm