Shutting down the RevPi

Caution, data loss!

Like any computer, the RevPi should not just be taken off the power, but shut down properly. Otherwise there is a risk of data loss. The article about shutting down is therefore actually a bit late. I only became aware of this topic after I accidentally disconnected the RevPi from the power supply a few times, because the power supply is connected to the switch socket of the computer and I turn it off in the evening. Fortunately nothing happened so far.

Manual shutdown

The most obvious is to simply connect to the RevPi via SSH and shut it down manually. To do this you need the command shutdown, where the command needs root privileges.

shutdown supports several parameters which I would like to mention briefly. With -h <time> you can define when the RevPi should shutdown. With now the RevPi shuts down immediately.

sudo shutdown -h now

The parameter -h instructs the system to stop or power off after shutdown. This is the standard behavior of shutdown. Therefore, you can conveniently omit the -h.

The following command will instruct shutdown to shut down in 60 minutes

sudo shutdown 60

SSH session showing the output for the command "shutdown 60"

You can also set a time, e.g. if you want the RevPi to shut down after work

sudo shutdown 18:45

SSH session showing the output for the command "shutdown 18:45"

If you do not specify a time span or a time, shutdown will shut down after two minutes.

If you change your mind, you can abort a once triggered shutdown with -c. Kindly shutdown reminds you of this when you execute it.

With sudo shutdown -r <time> you can also restart the RevPi. The time specifications work in the same way as for -h.

Shutdown with remote command

In the previous post I described how to execute commands remotely. This is of course useful for shutdown.  With the key set up, I can run RevPi with OpenSSH just like that:

ssh -i revpi_connect_33093_openssh pi@192.168.178.32 -t sudo shutdown -h now

Alternatively, I created a script shutdown.txt for Putty.

Screenshot of the Windows Editor showing shutdown.txt with the command "shutdown -h now"

This can then be executed just like that:

putty -i revpi_connect_33093.ppk pi@192.168.178.32 -m shutdown.txt