Howto

Comando Shutdown – Linux Shutdown Command

Shutdown: Spegniamo il Pinguino

comando shutdown
comando shutdown

comando shutdown

In questo piccolo tutorial, vi mostreremo come utilizzare il comando shutdown attraverso esempi pratici e spiegazioni dettagliate delle opzioni di spegnimento più comuni.

Il comando shutdown puo’ arrestare il sistema anche in modo sicuro. Quando si avvia l’arresto, tutti gli utenti e i processi connessi vengono informati del fatto che il sistema si sta spegnendo e non sono consentiti ulteriori accessi. È inoltre possibile spegnere il sistema immediatamente o all’ora specificata.

Le espressioni dell’utility shutdown  assumono la forma seguente:

shutdown [OPZIONI] [ORA-TIME] [MESSAGGIO]

opzioni – Opzioni di spegnimento come arresto, spegnimento (l’opzione predefinita) o riavvio del sistema.
time – L’argomento time specifica quando eseguire il processo di spegnimento.
Messaggio – L’argomento Messaggio specifica un messaggio che sarà trasmesso a tutti gli utenti.

Come utilizzare shutdown

Nella sua forma più semplice, se usato senza alcun argomento, shutdown spegne la macchina.

sudo shutdown

L’argomento “time” può avere due diversi formati. Può essere un tempo assoluto nel formato hh:mm e nel formato +m dove m è il numero di minuti dall’esecuzione del comando.

Nell’esempio seguente viene pianificato uno spegnimento del sistema alle ore 9.10

sudo shutdown 9:10

Spegnamolo ora …

sudo shutdown now

sudo shutdown +0

Spegniamolo tra quindici minuti

sudo shutdown +15

Mandiamo un messaggio in broadcast

sudo shutdown +15 “Tra 15 minuti ci sarà uno spegnimento programmato del sistema – Grazie”

Facciamo ripartire il sistema

sudo shutdown -r  +15 “Tra 15 minuti ci sarà un riavvio programmato del sistema – Grazie”

Ok abbiamo sbagliato blocchiamo tutto

sudo shutdown -c “Tra 15 minuti non ci sarà più il riavvio programmato del sistema – Grazie 🙂 “

E non dimenticate man shutdown 

gianni@raspberrypi:~ $ man shutdown

SHUTDOWN(8) shutdown SHUTDOWN(8)

NAME
shutdown – Halt, power-off or reboot the machine

SYNOPSIS
shutdown [OPTIONS…] [TIME] [WALL…]

DESCRIPTION
shutdown may be used to halt, power-off or reboot the machine.

The first argument may be a time string (which is usually “now”). Optionally, this may be followed by a wall message to be sent to all logged-in users before going down.

The time string may either be in the format “hh:mm” for hour/minutes specifying the time to execute the shutdown at, specified in 24h clock format. Alternatively it may be in the syntax “+m” referring to the specified number of minutes m from now. “now” is an alias for “+0”, i.e. for triggering an immediate shutdown. If no time argument is specified, “+1” is implied.

Note that to specify a wall message you must specify a time argument, too.

If the time argument is used, 5 minutes before the system goes down the /run/nologin file is created to ensure that further logins shall not be allowed.

OPTIONS
The following options are understood:

–help
Print a short help text and exit.

-H, –halt
Halt the machine.

-P, –poweroff
Power-off the machine (the default).

-r, –reboot
Reboot the machine.

-h
Equivalent to –poweroff, unless –halt is specified.

-k
Do not halt, power-off, reboot, just write wall message.

–no-wall
Do not send wall message before halt, power-off, reboot.

-c
Cancel a pending shutdown. This may be used cancel the effect of an invocation of shutdown with a time argument that is not “+0” or “now”.

quindi buon shutdown !