From 58001115cec9cd2b3fcf0672f466a7aad81d6f38 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Sun, 28 Jan 2018 18:53:43 +0100 Subject: [PATCH] New STATE number for service state --- sats/sysd | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/sats/sysd b/sats/sysd index be5a246..435db5d 100644 --- a/sats/sysd +++ b/sats/sysd @@ -19,6 +19,17 @@ source $ROOT/com/config_sats; SERV_LIST="ls /lib/systemd/system/sats-*"; while sleep 1; do - for i in $SERV_LIST; do test "`systemctl is-active $(basename $i)`" = "active" && echo "SYSD1`basename $i`" >> $BUF_OUT || echo "SYSD0`basename $i`" >> $BUF_OUT; done; + for i in $SERV_LIST; do + + status="`systemctl is-active $(basename $i)`"; + + test "$status" = "failed" && echo -n "SYSD0" >> $BUF_OUT; + test "$status" = "inactive" && echo -n "SYSD1" >> $BUF_OUT; + test "$status" = "activating" && echo -n "SYSD2" >> $BUF_OUT; + test "$status" = "active" && echo -n "SYSD3" >> $BUF_OUT; + + echo "`basename $i`" >> $BUF_OUT; + + done; done; \ No newline at end of file