* SIGINT - roll back services and then fork/exec /sbin/reboot
* SIGQUIT - exec() /sbin/shutdown without rolling back services
*
- * It's an open question about whether dinit should roll back services *before*
+ * It's an open question about whether Dinit should roll back services *before*
* running halt/reboot, since those commands should prompt rollback of services
- * anyway. But it seems safe to do so.
+ * anyway. But it seems safe to do so, and it means the user can at least stop
+ * services even if the halt/reboot commands are unavailable for some reason.
*/
}
}
-/* handle SIGINT signal (generated by kernel when ctrl+alt+del pressed) */
+/* handle SIGINT signal (generated by Linux kernel when ctrl+alt+del pressed) */
static void sigint_reboot_cb(EventLoop_t &eloop) noexcept
{
service_set->stop_all_services(ShutdownType::REBOOT);
close_control_socket();
execl("/sbin/shutdown", "/sbin/shutdown", "--system", (char *) 0);
log(LogLevel::ERROR, "Error executing /sbin/shutdown: ", strerror(errno));
+ sync(); // since a hard poweroff might be required at this point...
}
/* handle SIGTERM/SIGQUIT(non-system-daemon) - stop all services and shut down */