Timer to shutdown

14,780

Solution 1

The correct command would be sudo shutdown -h 23:45 - without the -h or -r switch it isn't a valid command (there are others - see man page).

Using +9 instead of the time gives you any easy way to say 'in 9 minutes'.

Any reference to E:/ tells us that there is some reference to a windows command going on here as linux has no E:/ which is partly why there are comments as to what you really typed, above - please copy/paste commands, don't re-type them!

Solution 2

sudo shutdown -h +30 will let the system power off after 30 minutes.

Share:
14,780

Related videos on Youtube

Swinzon
Author by

Swinzon

Updated on September 18, 2022

Comments

  • Swinzon
    Swinzon about 1 year

    I just installed Ubuntu 14.04 on my Intel NUC DN2820. And almost every night as I lie down to sleep I listen to music, and my NUC shuts down (On Windows). On Windows it has the easiest command ever in CMD: Shutdown -s -t 1000.

    That doesn't work on Ubuntu I figured out, but I found this command: Sudo shutdown 18:45, for those who don't know, 18:45 is an example when the system will shut down.

    I tried this in terminal: Sudo shutdown 01:00 and I got a message in terminal '' E:/ can`t find the command'' The E: drive is my external drive, and C: is my SSD, what can I do to get it to shut down?

    Thanks :)

    • αғsнιη
      αғsнιη almost 9 years
      you have two typo: 1) change Shutdown to shutdown and 2) change Sudo to sudo. note uppercase s
    • Swinzon
      Swinzon almost 9 years
      Can you give me the exact command? :))
  • Swinzon
    Swinzon almost 9 years
    Thanks! :D I`ll try when I get home :) So I can use sudo shutdown -h +9?
  • Mark Williams
    Mark Williams almost 9 years
    yes - or any other time period (minutes) you fancy. now works as well.
  • terdon
    terdon almost 9 years
    @Swinzon yes, exactly. You can find out more about shutdown by running man shutdown. For seconds, use -t, for example sudo shutdown -h -t 60 will shutdown in one minute. It is the same as running sudo shutdown -h +1.
  • Mark Williams
    Mark Williams almost 9 years
    there's sudo pm-suspend, if you like. You could set this up as sleep 39m ; sudo pm-suspend to zap it in a while...
  • Swinzon
    Swinzon almost 9 years
    I didn't get it to work...
  • Mark Williams
    Mark Williams almost 9 years
    That's a shame, works on my ASUS eee... & desktop. What DID it do?
  • Mark Williams
    Mark Williams almost 9 years
    Most odd! something must have killed the running shutdown - it shouldn't just quit during the delay, obviously.. What happens with sudo shutdown -h now? Also might be worth checking /var/log/auth.log to check it did actually process the sudo.