diff --git a/main/gen_gdl90.go b/main/gen_gdl90.go index 1ff0b0bb2..912b04bc5 100644 --- a/main/gen_gdl90.go +++ b/main/gen_gdl90.go @@ -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) } } } diff --git a/main/managementinterface.go b/main/managementinterface.go index a0328d44c..cc74fd2e7 100644 --- a/main/managementinterface.go +++ b/main/managementinterface.go @@ -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) {