Prevent error if service doesn't exist

This commit is contained in:
Ryan Hughes
2025-12-15 18:47:11 -05:00
parent ee8f62d967
commit f3b9ca2149

View File

@@ -9,10 +9,20 @@ if [[ $EUID -eq 0 ]]; then
# Restart services as the script owner
systemd-run --uid="$SCRIPT_OWNER" --setenv=XDG_RUNTIME_DIR="/run/user/$USER_UID" \
bash -c "
systemctl --user restart elephant.service
systemctl --user restart app-walker@autostart.service
if systemctl --user is-enabled elephant.service &>/dev/null; then
systemctl --user restart elephant.service
fi
if systemctl --user is-enabled app-walker@autostart.service &>/dev/null; then
systemctl --user restart app-walker@autostart.service
fi
"
else
systemctl --user restart elephant.service
systemctl --user restart app-walker@autostart.service
if systemctl --user is-enabled elephant.service &>/dev/null; then
systemctl --user restart elephant.service
fi
if systemctl --user is-enabled app-walker@autostart.service &>/dev/null; then
systemctl --user restart app-walker@autostart.service
fi
fi