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 = {
|
"sane-scripts.reboot".sandbox = {
|
||||||
method = "bunpen";
|
method = "bunpen";
|
||||||
whitelistSystemctl = true;
|
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 = {
|
"sane-scripts.reclaim-disk-space".sandbox = {
|
||||||
|
@@ -9,8 +9,9 @@ if [ "$host" = "$target" ]
|
|||||||
then
|
then
|
||||||
# N.B.: anything other than just `reboot` with no args requires `sudo` privileges (to write to /run/systemd/).
|
# 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).
|
# `systemctl reboot -i` tells systemd to ignore inhibitors (i.e. other users logged in).
|
||||||
reboot "$@" || \
|
timeout 5 reboot "$@" || \
|
||||||
systemctl reboot -i "$@"
|
timeout 5 systemctl reboot -i "$@" || \
|
||||||
|
(sync && reboot --force --force "$@") #< XXX: requires root
|
||||||
else
|
else
|
||||||
echo "WRONG MACHINE. you're on $host."
|
echo "WRONG MACHINE. you're on $host."
|
||||||
exit 1
|
exit 1
|
||||||
|
Reference in New Issue
Block a user