Assuming you've just entered the command shutdown -h now (or something equivalent), is there realistically anything you can do (if you're quick enough) to prevent the machine shutting down?

  • Once you invoke shutdown -h now, I believe you lose command line access immediately similarly to halt -p so there isn't much you can do.
    – Ken
    Jan 18, 2011 at 16:41
  • @Ken: on Ubuntu and Centos connected via putty the command line remains available for a few seconds.
    – user591
    Jan 18, 2011 at 18:43
  • Why say "now" if you don't mean "right now"?
    – Fred Nurk
    Jan 18, 2011 at 20:27

4 Answers 4


You can run shutdown -c to cancel an already running shutdown.

  • 1
    Did not believe it at first, but yes. More specifically ctrl+c
    – Ken
    Jan 18, 2011 at 16:45
  • 4
    @Ken: shutdown -c and [Ctrl]+[c] are entirely different. shutdown -c is a command which cancels a previously scheduled shutdown (even "now" is scheduled in this sense --- but whether the cancellation will prevent the reboot is a bit of a race in that case). [Ctrl]+[c] will cause you terminal to generate a SIGINT (interrupt signal) to whichever process was currently attached to it. This might work on a running shutdown command but that's rather incidental to your question.
    – Jim Dennis
    Jan 18, 2011 at 17:25
  • 1
    @Jim Dennis: I'm aware of the difference between ctrc+c and shutdown -c. But given the speed of the -now option rather than its scheduled sibling, ctrl+c would be the fastest route to that end. I didn't believe you could stop an immanent shutdown, even more surprised that you can interrupt it, but apparently you can, but it's a race as you stated.
    – Ken
    Jan 18, 2011 at 17:45

If you are fast enough you can issue an init 2 (or whatever runlevel you want) and that will likely stop the shutdown. Anything involving killing the shutdown command will fail as the command runs too quickly

I tried this with the script below and and even it's not fast enough to stop the shutdown

shutdown -h now
shutdown -c "Aborting Shutdown"

Broadcast message from iain@iain-ubuntu
        (/dev/pts/0) at 16:50 ...

The system is going down for halt NOW!
shutdown: Cannot find pid of running shutdown

Where as interactively

shutdown -h now
init 2 

the system stays up.


From the FreeBSD man page:

A scheduled shutdown can be canceled by killing the shutdown process (a SIGTERM should suffice).

So killall shutdown works on BSD when there is a scheduled shutdown (e.g. shudown -h +5).

I don't think it's feasible to cancel an immediate shutdown (shutdown -h now) in real-life scenario.


suppose, you sent a reboot or shutdown message to all terminal for maintenance purpose that the "server is going to reboot or shutdown for maintenance purpose within 10 minutes"

This kind of command can cancel.

just press Ctrl+C

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.