Switching off under software control
Chris Hall (132) 3505 posts |
I have got a Raspberry Pi mounted on a Witty Pi, turning on and off under software control. It has a RTC but no keyboard, mouse or monitor. This works fine using GPIO BCM 4 to tell Witty Pi to turn off. Another variant has no Witty Pi and stays on until you tell it to power off by using a push button (via GPIO). Although it has no RTC, it gets its time and date from the GPS module, but only a few seconds after power on. It starts up at the previous shutdown time. At present the push button just shuts down the application !SatNav allowing you then to switch off without worrying that it might be updating the log at the same time. Using this method, each time you switch on its initial time will be the same. As part of the debugging I use the switch on time to create a log file with a unique name (with a resolution of 2.56s) so using this method it gets overwritten. What I therefore need to do is to issue a command from within the application that will invoke the Shutdown CTRL-SHIFT-f12 procedure (which updates the shutdown time), ignoring the prequit (as the Wimp_Poll loop has by now been exited) shouldn’t matter. [On screen you would see a blank desktop with ‘now ready to be switched off’ and the !SatNav app still on the icon bar.] Suggestions please? Is a *SaveCMOS command sufficient to update the shutdown time [i.e. the value used to set the system time and date to a specific ‘must be no earlier than this’ time/date on start up in absence of a valid RTC value]? Would *Stamp SDFS::0.$.!Boot.Loader.CMOS be sufficient? |
Chris Hall (132) 3505 posts |
I think I have found a platform-independent command: |
Alan Adams (2486) 1126 posts |
I’ve just been trying something similar -0 actually a simple way to restart or shutdown remote, headless computers. SYS “OS-Reset” works fine for restarting. |