How to Shutdown and Reboot Linux PC automatically

advertisement logo

 

A quick tip on how to shutdown your GNU Linux computer automatically,

Suppose you need your Linux pc to shutdown automatically at certain time, you can use this command line :

shutdown -hP 23:55

which instructs your box to power down at exactly 11:55 pm. The ‘h’ parameter instructs the program to halt the computer (init runlevel 6) and ‘P’ instructs it to power off the pc.

Note: You can also add an optional message and 20 seconds shutdown delay,

shutdown -hP 23:55 -t 20 Going to power down, let's call it a day

the delay is useful for you to finish off whatever you’re doing before the pc powers down.

Why do I use this command ?
Recently the doctor diagnose me with low blood pressure and advised me to sleep early and to eat more stuff that contains iron. So by using this command I can limit my online pc time, and let me sleep early.

I’ll show you how to shutdown your computer using countdown timer.

Here’s an example how you can shutdown your pc in one hour with 30 second delay between final warning and the actual shutdown.

shutdown -hP -t 30 60 Please save your work, the lab is going to be closed soon

you can use this command to reboot your computer too,

shutdown -r

Note that you need to have root access in order to use this command. That’s all for now, enjoy the holiday

[tags]shutdown,bash,linux,command line, gnu/linux, debian[/tags]


Share this post

Keep updated with the latest posts, be a part of over 1,000 subscribers! : email iconSubscribe to your email

3 smashing comments for this post.

  1. ping.sg :: The Community Meta Blog for Singapore Bloggers Said:

    at certain time, you can use this command line :shutdown -hP 23:55which instructs your box to power down at exactly 11:55 pm. The ‘h’ parameter instructs the program to halt the computer (init runlevel 6) and ‘P’ instructs it … 0 pong [IMG Direct link]

  2. Recently Updated Blog : fakapster blog update service Said:

    Bla… Bla… Bla… Sempre pensei que fazer um atentado era o mais simples que se poderia fazer, mas isto agora assusta-me… Uma gota uma melancia… uma garrafa daquilo dava para fazer desaparecer o que?… How to Shutdown and Reboot Linux PC automatically 2 hours 57 minutes ago @ mypapit gnu/linux blog A quick tip on how to shutdown your GNU Linux computer automatically, Suppose you need your Linux pc to shutdown automatically at certain time, you can use this command line : shutdown -hP 23:55 wh…

  3. Fedora Core 6 zeitverzögert herunterfahren - Dravennet.de - Das Webportal Said:

    [...]  Passwort vergessen?  » Thema: Fedora Core 6 zeitverzögert herunterfahren   [ Nächstes Thema » ] 23.01.2007, 19:31 Uhr      Michael Ich hab mich schon seit längerem gefragt wie ich es schaffe das mein Pc kurz nach mir ins Bett geht. Wenn ich nen Download hatte, den noch ne halbe Stunde dauerte oder wenn ich Musik hören wollte, aber über Nacht nicht den nervigen Pfeifton der Lüfter in den Ohren haben wollte. Nunja mit viel Hilfe von Draven und ner Internetseite weiß ich nun was ich im Terminal eingeben muß. Es gibt 2 Möglichkeiten, einmal das zeitverzögerte Runterfahren und einmal das Herunterfahren zu einer bestimmten Zeit. Jedoch braucht man für beides Root-Rechte, also schön brav "su" und Passwort eingeben. Das zeitverzögerte Runterfahren: -die Eingabe ins Terminal lautet: /sbin/shutdown -h 60 (hier fährt der PC nach einer Stunde herunter) -Man kann auch eine Nachricht einfüge die eine bestimmte Zeit vorher angezeigt wird: /sbin/shutdown -h -t 30 60 Sichere schnell deine Daten (hier wird 30sec vor Herunterfahren die SystemNachricht "Sichere deine Daten" angezeigt) Das Runterfahren zu einer bestimmten Zeit: -die eingabe ins Terminal lautet: /sbin/shutdown -h 0:30 (um 00:30Uhr würde der Pc hier runterfahren) -Auch hier is das anzeigen einer Nachricht kurz vorher möglich: /sbin/shutdown -h 23:55 -t 20 So jetzt gehts ins Bett (20sec vor 23:55Uhr kommt die Systemnachricht "So jetzt gehts ins Bett") Natürlich kann man seinen Pc auch geplant Restarten, einfach mal /sbin/shutdown eingaben und schon erhält man die einsetzbaren Befehle und die Parameter. Vielleicht hilft das dem einem oder anderen, ich finde es toll. Falls mir ein Fehler unterlaufen ist könnt ihr mich gerne drauf hinweisen. hier noch eine Quelle: How to Shutdown and Reboot Linux        [...]

Leave a Comment

Subscribe by email

Enter your Email