Call `gracefulShutdown()` before reboot.

Fixes #717.
rxwx v1.5b2
cyoung 2019-02-01 16:06:22 -05:00
rodzic 39bb2e3415
commit 8f4a52d739
2 zmienionych plików z 4 dodań i 4 usunięć

Wyświetl plik

@ -1446,7 +1446,7 @@ func openReplayFile(fn string) ReadCloser {
var stratuxClock *monotonic
var sigs = make(chan os.Signal, 1) // Signal catch channel (shutdown).
// Graceful shutdown.
// Graceful shutdown. Do everything except for kill the process.
func gracefulShutdown() {
// Shut down SDRs.
sdrKill()
@ -1463,7 +1463,6 @@ func gracefulShutdown() {
// Turn off green ACT LED on the Pi.
ioutil.WriteFile("/sys/class/leds/led0/brightness", []byte("0\n"), 0644)
os.Exit(1)
}
// Close log file handle, open new one.
@ -1489,6 +1488,7 @@ func signalWatcher() {
} else {
log.Printf("signal caught: %s - shutting down.\n", sig.String())
gracefulShutdown()
os.Exit(1)
}
}
}

Wyświetl plik

@ -414,14 +414,14 @@ func handleSettingsSetRequest(w http.ResponseWriter, r *http.Request) {
func handleShutdownRequest(w http.ResponseWriter, r *http.Request) {
syscall.Sync()
syscall.Reboot(syscall.LINUX_REBOOT_CMD_POWER_OFF)
gracefulShutdown()
syscall.Reboot(syscall.LINUX_REBOOT_CMD_POWER_OFF)
}
func doReboot() {
syscall.Sync()
syscall.Reboot(syscall.LINUX_REBOOT_CMD_RESTART)
gracefulShutdown()
syscall.Reboot(syscall.LINUX_REBOOT_CMD_RESTART)
}
func handleDeleteLogFile(w http.ResponseWriter, r *http.Request) {