From f90eab9b57ef058ef239fa6921bdcb198af5b06a Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Mon, 25 Feb 2013 20:53:50 +0100 Subject: Add missing script toggle_user_unit.sh --- .scripts/toggle_user_unit.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 .scripts/toggle_user_unit.sh 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 -- cgit