From f342cde66665ec4024059fc74829bc098d40b536 Mon Sep 17 00:00:00 2001 From: memoryleakno1 Date: Tue, 8 Aug 2017 10:00:20 +0200 Subject: [PATCH] Added plugin for Systemd --- plugins/available/systemd.plugin.bash | 50 +++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 plugins/available/systemd.plugin.bash diff --git a/plugins/available/systemd.plugin.bash b/plugins/available/systemd.plugin.bash new file mode 100644 index 00000000..a68cc984 --- /dev/null +++ b/plugins/available/systemd.plugin.bash @@ -0,0 +1,50 @@ +# Author: Arthur Miller +# Created: 2017-08-08 +# License: Public Domain + +cite about-plugin +about-plugin 'SystemD helper functions' + +# Reloads a systemwide service. If no agruments are given, reloads all services. +# Requires admin priviledge. +scrs(){ + if [ $# -eq 0 ]; then + systemctl --user daemon-reload + else + echo "Stopping $1.service ..." + systemctl stop "$1.service" + echo "Starting $1.service ..." + systemctl start "$1.service" + fi; +} + +# Display status of a systemwide service. If no arguments are given, display +# status for all services. Requires admin priviledge. +scst(){ + if [ $# -eq 0 ]; then + systemctl status + else + systemctl status "$1.service" + fi; +} + +# Reloads an user service. If no agruments are given, reloads all user services. +scurs(){ + if [ $# -eq 0 ]; then + systemctl --user daemon-reload + else + echo "Stopping $1.service ..." + systemctl --user stop "$1.service" + echo "Starting $1.service ..." + systemctl --user start "$1.service" + fi; +} + +# runs systemctl --user status command +scust(){ + if [ $# -eq 0 ]; then + systemctl --user status + else + systemctl --user status "$1.service" + fi; +}