Shutdown_raspberry

A clean shutdown of raspberry over LAN when my main computer shuts off.

The simplest solution:

  • make is possible to login to raspberry over ssh without entering a passphrase. This is done with ssh_keygen and ssh_copy_id.
  • sending a command after login. Well.. ssh takes a command. You can do this: ssh user@host 'sudo shutdown -h now'.
  • Make your own version of shutdown on the main computer that first run the ssh-command and then calls the proper, local shutdown.

When you execute my_shutdown -h now.. the script (Ruby in my case) first do the system call system %(ssh user@host 'sudo shutdown #{*args}'), then do the same locally.