From d9956e8f094c9e1b1c38f0d25792f7ded11f879b Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sun, 26 Jun 2022 15:38:14 -0700 Subject: REBOOT:AT-END: add fallback scheduling Signed-off-by: Sean Whitton --- src/property/reboot.lisp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/property/reboot.lisp b/src/property/reboot.lisp index fe213d8..3fa324a 100644 --- a/src/property/reboot.lisp +++ b/src/property/reboot.lisp @@ -19,11 +19,17 @@ (named-readtables:in-readtable :consfigurator) (defprop %at-end :posix () - (:apply (consfigurator:at-end - (lambda (result) - (declare (ignore result)) - (mrun "shutdown" "-r" "+1") - (inform t "*** SYSTEM REBOOT SCHEDULED, one minute delay ***"))))) + (:apply + (consfigurator:at-end + (lambda (result) + (declare (ignore result)) + (handler-case (mrun "shutdown" "-r" "+1") + ;; Sometimes after INSTALLER::%ROOT-FILESYSTEMS-FLIPPED shutdown(8) + ;; can't schedule a future reboot, but an immediate one is fine. + (run-failed () + (mrun "nohup" "sh" "-c" + "(sleep 60; shutdown -r now) /dev/null 2>&1 &"))) + (inform t "*** SYSTEM REBOOT SCHEDULED, one minute delay ***"))))) (defproplist at-end :posix () "Schedule a reboot for the end of the current (sub)deployment. -- cgit v1.2.3