Zum Runterfahren benutze ich einen Alias:
alias powerofff='rm -rf /tmp/trash& pkill -9 watchdog; pkill -9 wd_keepalive; sync& nohup /root/bin/powerofff.sh > /tmp/foo.out 2> /tmp/foo.err < /dev/null & disown -a'
und ein Skript:
Code:
!/bin/bash
# powerofff.sh: Fail safe poweroff, when "poweroff" does not work but shutdown should be done as good as possible.
# For correct function this script must be started with nohup, so that if can continue working even if the login
# or console terminated.
# With an alias like alias powerofff='nohup /root/bin/powerofff.sh' the usage is similar to a simple poweroff.
# I made this script because sometimes, espacially at ssh remote login, the simple poweroff remained hanging
# at shutdown and that can't be detected remotely without a help like IPMI.
sync& # save cached data non-waiting
poweroff& # do a poweroff with shutdown (common termination of all processes)
sleep 6 # 6 seconds first timeout
shutdown -P now & # another poweroff
sleep 6 # 6 seconds timeout to the next poweroff
halt -p & # another poweroff
sleep 6 # 6 secondd timeout to the hard and last poweroff
poweroff -f # poweroff without shutdown
init 0 # should never happen
Das muss natürlich von root gestartet werden.
Entwickelt habe ich das ursprünglich für das Leben in vollen Zügen, also wenn man mal wieder merkt das der Zug gleich im Zielbahnhof ankommt und das Notebook deshalb zügig poweroff machen muss.
Die Version für den Windows-Desktop ist eine Batch-Datei mit zwei Zeilen, mit dem Stop der Netzdienste, damit nicht ein Prozess davon blockiert, die vom einfachen User ausgeführt wird:
Code:
net stop server /yes
shutdown.exe -s -f -t 3 -c "Windows (Winzigweich Fenster7) wird in 3 Sekunden vollstaendig heruntergefahren!"
Lesezeichen