summaryrefslogtreecommitdiff
path: root/.scripts
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2013-02-25 20:53:50 +0100
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2013-02-25 20:53:50 +0100
commitf90eab9b57ef058ef239fa6921bdcb198af5b06a (patch)
tree36d3ab51df95a9b5dee601587cd1e777098fd3e2 /.scripts
parent9c5da5e907c9e6a4868b8ecd9aaf5a0a9c3d84ee (diff)
downloaddotfiles-f90eab9b57ef058ef239fa6921bdcb198af5b06a.tar.gz
dotfiles-f90eab9b57ef058ef239fa6921bdcb198af5b06a.tar.bz2
dotfiles-f90eab9b57ef058ef239fa6921bdcb198af5b06a.zip
Add missing script toggle_user_unit.sh
Diffstat (limited to '.scripts')
-rwxr-xr-x.scripts/toggle_user_unit.sh12
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