2018-01-28 17:28:59 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# (1) Primary init.
|
|
|
|
#--------------------------------------------------------#
|
|
|
|
# (1) Get absolute folder #
|
|
|
|
ROOT=$(dirname `realpath $0`);
|
|
|
|
ROOT=`dirname $ROOT`;
|
|
|
|
|
|
|
|
# (2) Check config file #
|
|
|
|
test ! -f $ROOT/com/config_sats && echo "Daemon not started" && exit 1;
|
|
|
|
|
|
|
|
# (3) Fetch BUFFERS #
|
|
|
|
source $ROOT/com/config_sats;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# (2) Start daemon
|
|
|
|
#--------------------------------------------------------#
|
|
|
|
SERV_LIST="ls /lib/systemd/system/sats-*";
|
|
|
|
while sleep 1; do
|
|
|
|
|
2018-01-28 17:53:43 +00:00
|
|
|
for i in $SERV_LIST; do
|
|
|
|
|
|
|
|
status="`systemctl is-active $(basename $i)`";
|
2018-01-28 18:08:11 +00:00
|
|
|
serv="`basename $i`";
|
2018-01-28 17:53:43 +00:00
|
|
|
|
2018-01-28 18:08:11 +00:00
|
|
|
if [ "$status" = "failed" ]; then
|
2018-01-28 18:10:14 +00:00
|
|
|
echo "SYSD0$serv" >> $BUF_OUT;
|
2018-01-28 17:53:43 +00:00
|
|
|
|
2018-01-28 18:08:11 +00:00
|
|
|
elif [ "$status" = "inactive" ]; then
|
2018-01-28 18:10:14 +00:00
|
|
|
echo "SYSD1$serv" >> $BUF_OUT;
|
2018-01-28 18:08:11 +00:00
|
|
|
|
|
|
|
elif [ "$status" = "activating" ]; then
|
2018-01-28 18:10:14 +00:00
|
|
|
echo "SYSD2$serv" >> $BUF_OUT;
|
2018-01-28 18:08:11 +00:00
|
|
|
|
|
|
|
elif [ "$status" = "active" ]; then
|
2018-01-28 18:10:14 +00:00
|
|
|
echo "SYSD3$serv" >> $BUF_OUT;
|
2018-01-28 18:08:11 +00:00
|
|
|
|
|
|
|
fi;
|
2018-01-28 17:53:43 +00:00
|
|
|
|
|
|
|
done;
|
2018-01-28 17:28:59 +00:00
|
|
|
|
|
|
|
done;
|