From b17e11137a62e26a1d4ac9f65a112f223c52ea3f Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Mon, 29 Jan 2018 18:49:34 +0100 Subject: [PATCH] updated: sats-debug@.service (according to example) + updated: sats.sysd (to take services from files + instances) --- sats-debug@.service | 7 ++----- sats/sysd | 13 ++++++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/sats-debug@.service b/sats-debug@.service index ef28234..1235ee1 100644 --- a/sats-debug@.service +++ b/sats-debug@.service @@ -2,13 +2,10 @@ Description=[::SATS::] Debugger (to %i) [Service] -Type=simple -Restart=always +Type=oneshot User=pi Group=pi -ExecStartPre=/usr/bin/sudo -u sats git clone --recursive -b master ssh://smmp-server/satsd/debug /home/pi/debug -ExecStartPre=/usr/bin/sudo chown -R pi:pi /home/pi/debug -ExecStartPre=/usr/bin/sudo chmod -R 750 /home/pi/debug +ExecStartPre=-/usr/bin/git clone --recursive -b master ssh://smmp-server/satsd/debug /home/pi/debug ExecStart=/bin/bash /home/pi/debug/sats/main %i ExecStop=/bin/sleep 10 diff --git a/sats/sysd b/sats/sysd index 9623ead..a2458de 100755 --- a/sats/sysd +++ b/sats/sysd @@ -17,23 +17,26 @@ source $ROOT/com/config/sats; # (2) Start daemon #--------------------------------------------------------# SERV_LIST="`systemctl list-units --plain | grep 'sats' | grep -v '.slice' | awk '{print $1}'`"; +SERV_LIST="`ls -l /lib/systemd/system/sats-* | grep -vP '~$' | grep -vP '@.service$' | awk '{print $NF}'`$SERVLIST"; + while sleep 1; do for serv in $SERV_LIST; do - status="`systemctl is-active $(basename $serv)`"; + serv_name=`basename $serv`; + status="`systemctl is-active $serv_name`"; if [ "$status" = "failed" ]; then - echo "SYSD0$serv" >> $BUF_OUT; + echo "SYSD0$serv_name" >> $BUF_OUT; elif [ "$status" = "inactive" ]; then - echo "SYSD1$serv" >> $BUF_OUT; + echo "SYSD1$serv_name" >> $BUF_OUT; elif [ "$status" = "activating" ]; then - echo "SYSD2$serv" >> $BUF_OUT; + echo "SYSD2$serv_name" >> $BUF_OUT; elif [ "$status" = "active" ]; then - echo "SYSD3$serv" >> $BUF_OUT; + echo "SYSD3$serv_name" >> $BUF_OUT; fi;