remote-config

Remote administration scripts for Arch Linux
git clone git://git.danielmoch.com/remote-config.git
Log | Files | Refs

commit 694fcb99a27dccabef980eb7fae9a0453c00dc6a
parent 0dd25108de1a62e611116b0a28100549f96dc531
Author: Daniel Moch <daniel@danielmoch.com>
Date:   Sat,  9 Feb 2019 08:27:51 -0500

Add start_services common function

Diffstat:
Mcommon.sh | 24++++++++++++++++++++++++
1 file changed, 24 insertions(+), 0 deletions(-)

diff --git a/common.sh b/common.sh @@ -62,3 +62,27 @@ install_packages() pacman -S --noconfirm "$@" fi } + +start_services() +{ + for service + do + state=`systemctl show $service --property=ActiveState` + if [ ! "$state" = "ActiveState=active" ] + then + if [ -z "$services" ] + then + services=$service + else + services="$services $service" + fi + fi + done + + if [ -n "$services" ] + then + echo "Starting services: $services" + set -- $services + systemctl start $services + fi +}