mirror of
https://github.com/troglobit/finit.git
synced 2026-10-19 11:09:35 +00:00
Fix #302: add support for running scripts at shutdown
This change adds support for running hook scripts at two new hook points during the shutdown process: - HOOK_SVC_DN: after all services and non-reserved processes have been killed (and collected) - HOOK_SYS_DN: after all file systems have been unmounted, *just prior* to Finit calling reboot() to shut down or reboot the system See doc/plugins.md for details and an example. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
5f74adad06
commit
d810ac00bc
5 files changed
+74
-11
No files matched your search
@@ -329,6 +329,9 @@ void do_shutdown(shutop_t op)
|
||||
while (waitpid(-1, NULL, WNOHANG) > 0)
|
||||
;
|
||||
|
||||
/* All services and (non-critical) processes have stopped. */
|
||||
plugin_run_hooks(HOOK_SVC_DN);
|
||||
|
||||
if (in_cont) {
|
||||
if (osheading)
|
||||
logit(LOG_CONSOLE | LOG_NOTICE, "%s, shutting down container.", osheading);
|
||||
@@ -374,6 +377,9 @@ void do_shutdown(shutop_t op)
|
||||
/* Call mdadm to mark any RAID array(s) as clean before halting. */
|
||||
mdadm_wait();
|
||||
|
||||
/* Last chance to run scripts (all .so plugins have exited already) */
|
||||
plugin_run_hooks(HOOK_SYS_DN);
|
||||
|
||||
/* Reboot via watchdog or kernel, or shutdown? */
|
||||
if (op == SHUT_REBOOT) {
|
||||
if (wdog && wdog->pid > 1) {
|
||||
|
||||
Reference in new issue
Block a user