aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2022-06-26 15:38:14 -0700
committerSean Whitton <spwhitton@spwhitton.name>2022-06-27 13:26:21 -0700
commitd9956e8f094c9e1b1c38f0d25792f7ded11f879b (patch)
treeb508a341d1d4d392b826d034aeeea33589b046fe
parentd71c49cb57ff028c36c9645771f33249d1481632 (diff)
downloadconsfigurator-d9956e8f094c9e1b1c38f0d25792f7ded11f879b.tar.gz
REBOOT:AT-END: add fallback scheduling
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
-rw-r--r--src/property/reboot.lisp16
1 files 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 >/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.