diff options
Diffstat (limited to '.scripts')
-rwxr-xr-x | .scripts/toggle_user_unit.sh | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/.scripts/toggle_user_unit.sh b/.scripts/toggle_user_unit.sh new file mode 100755 index 0000000..6937585 --- /dev/null +++ b/.scripts/toggle_user_unit.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +unit=$1 + +which systemctl &> /dev/null || exit 1 +systemctl --user &> /dev/null || exit 1 + +if systemctl --user --quiet is-enabled $unit; then + systemctl --quiet --user is-active $unit && + systemctl --user stop $unit || \ + systemctl --user start $unit +fi |