Add fallback shutdown/reboot ...

This commit is contained in:
rootzoll
2022-01-08 20:55:24 +01:00
parent af0e18f361
commit 6e0254bba0

View File

@@ -60,4 +60,17 @@ sync
echo "starting shutdown ..."
sudo shutdown ${shutdownParams}
# detect missing DBUS
if [ "${$DBUS_SESSION_BUS_ADDRESS}" == "" ]; then
echo "WARN: Missing \$DBUS_SESSION_BUS_ADDRESS .. "
if [ "$1" = "reboot" ]; then
echo "RUNNING FALLBACK REBOOT .. "
sudo systemctl --force --force reboot
else
echo "RUNNING FALLBACK SHUTDOWN .. "
sudo systemctl --force --force poweroff
fi
fi
exit 0