I just received notification that our site has a power outage tomorrow morning.

I am a Windows admin but I have to cover for our Linux admin who's not around until tomorrow evening.

I need to shutdown our RHEL server at 06:45 tomorrow morning (without me doing it).

I have searched on here but see mixed answers using shutdown, some say -h, some say -p, some say something completely different.

It's ~21:15 now and I need to shutdown at 06:45 in the morning. What is the simplest way I can schedule this?


You can use shutdown:

sudo shutdown -h  06:45 &

And to check it:

ps -aux | grep shutdown

If you want to cancel it:

sudo shutdown -c

This assumes of course that the shutdown time has already passed.

  • Thanks for the answer but when I do this it just hangs until I Ctrl+C it ... ]# shutdown -g 06:45 Shutdown cancelled. . Nov 26 '14 at 21:26
  • 1
    @user4166144 Updated to background the process.
    – jmunsch
    Nov 26 '14 at 21:28
  • Great. I have shutdown -g 06:45 in ps output now. I take it I'm ok to close the SSH session, right? Nov 26 '14 at 21:33
  • 10
    instead of killall, why not shutdown -c ?
    – user14755
    Nov 26 '14 at 23:16
  • 1
    About closing the ssh session --- you can check (close and enter again, check if the shutdown is still running). Otherwise you'll need sudo nohup shutdown... ---although it shouldn't be needed (the HUP signal will be sent as a normal user, so...)
    – Rmano
    Nov 27 '14 at 19:23

You should use the at command:

$ sudo at 6:45
[sudo] password for root: 
warning: commands will be executed using /bin/sh
at> poweroff
at> <EOT>

Don't type the <EOT>, but press Ctrl+D at the second at> prompt.

The significant advantage of using at over using shutdown with a TIME argument, is that it involves real, persistent, scheduling, and works even if the machine is rebooted in the intermediate time period. The shutdown TIME will not restart automatically in such an event, which might cause a double ungraceful power off if the reboot in the intermediate time period was not anticipated.


Another way

su -c 'echo "systemctl poweroff" | at 06:45'

  • 4
    Assumption in your comment is RHEL7. Earlier versions would need to be done differently.
    – mdpc
    Nov 26 '14 at 22:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.