Programmatic graceful shutdown

Reading through the shake manual I noticed that shutting down the shake from the web GUI is the only recommended way in order to prevent damage and data corruption. Because I am developing a remote installation, access to the web GUI is not possible. Can someone provide me with an API that I can call (such as POST localhost/shutdown) so that I can programmatically perform a shutdown in the event of low power?

Thanks

hi,

yes, this is possible in other ways than just from the GUI. namely, the command

> rsh-system-cmd S

will shut down the machine for you safely (data services are first shut down in a friendly manner). likewise, the same command can be used to reboot the machine, but specifying ‘R’ as the sole argument:

> rsh-system-cmd R

there is no API available from the outside, for obvious security reasons, but this command can be sent using ssh to achieve the same result.

let me know if you have any other questions,

richard

2 Likes

Sorry to reopen this question after so many years. I have two questions:

  1. There are several instructions in the manual, for example, where the user is instructed to use the sudo reboot command. Would this be considered a “graceful shutdown”? Or do we need to first go through the rs.local dashboard and shutdown the shake?

  2. After doing rsh-system-cmd S and shutting down and unplugging the shake, does the reboot (rsh-system-cmd R) or any other command need to be done after turning the shake back on? Or does it automatically restart the rsh system/services when turned back on?

Thank you!

2 Likes

Hello rbalik,

Regarding your questions:

  1. That is correct, sudo reboot is a graceful shutdown command, as doing the same action via “rs.local/” is. Basically, anything different from “pulling the plug without shutting down the Shake” (which can damage the microSD card) can be considered as “graceful”.

  2. No, regardless of the shutdown method (sudo shutdown, rsh-system-cmd S, or others), all RS software services are started from a NULL state on system boot-up. That is, no assumptions are made as to how the system was previously shut down.

If you need anything else, let us know. You’re welcome!