43 lines
896 B
Bash
43 lines
896 B
Bash
#!/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
|
|
|
|
for i in $SERV_LIST; do
|
|
|
|
status="`systemctl is-active $(basename $i)`";
|
|
serv="`basename $i`";
|
|
|
|
if [ "$status" = "failed" ]; then
|
|
echo -n "SYSD0$serv" >> $BUF_OUT;
|
|
|
|
elif [ "$status" = "inactive" ]; then
|
|
echo -n "SYSD1$serv" >> $BUF_OUT;
|
|
|
|
elif [ "$status" = "activating" ]; then
|
|
echo -n "SYSD2$serv" >> $BUF_OUT;
|
|
|
|
elif [ "$status" = "active" ]; then
|
|
echo -n "SYSD3$serv" >> $BUF_OUT;
|
|
|
|
fi;
|
|
|
|
done;
|
|
|
|
done; |