sane-reboot: do a force reboot if the original command fails (experimental)
This commit is contained in:
@@ -135,6 +135,10 @@ in
|
||||
"sane-scripts.reboot".sandbox = {
|
||||
method = "bunpen";
|
||||
whitelistSystemctl = true;
|
||||
capabilities = [
|
||||
"sys_admin"
|
||||
];
|
||||
tryKeepUsers = true; #< allow `sudo sane-reboot`, for the case where the service manager is unreachable
|
||||
};
|
||||
|
||||
"sane-scripts.reclaim-disk-space".sandbox = {
|
||||
|
@@ -9,8 +9,9 @@ if [ "$host" = "$target" ]
|
||||
then
|
||||
# N.B.: anything other than just `reboot` with no args requires `sudo` privileges (to write to /run/systemd/).
|
||||
# `systemctl reboot -i` tells systemd to ignore inhibitors (i.e. other users logged in).
|
||||
reboot "$@" || \
|
||||
systemctl reboot -i "$@"
|
||||
timeout 5 reboot "$@" || \
|
||||
timeout 5 systemctl reboot -i "$@" || \
|
||||
(sync && reboot --force --force "$@") #< XXX: requires root
|
||||
else
|
||||
echo "WRONG MACHINE. you're on $host."
|
||||
exit 1
|
||||
|
Reference in New Issue
Block a user