#!/bin/bash # (1) Primary init. #--------------------------------------------------------# # (1) Get absolute folder # ROOT=$(dirname `realpath $0`); ROOT=`dirname $ROOT`; # (2) Start daemon #--------------------------------------------------------# SERV_LIST="`systemctl list-units --plain | grep 'sats' | grep -v '.slice' | grep -vP '@\.service$' | awk '{print $1}'`"; SERV_LIST="`ls -l /lib/systemd/system/sats-* | grep -vP '~$' | grep -vP '@\.service$' | awk '{print $NF}'` $SERV_LIST"; while sleep 1; do for serv in $SERV_LIST; do serv_name=`basename $serv`; status="`systemctl is-active $serv_name`"; if [ "$status" = "failed" ]; then echo "SYSD0$serv_name"; elif [ "$status" = "inactive" ]; then echo "SYSD1$serv_name"; elif [ "$status" = "activating" ]; then echo "SYSD2$serv_name"; elif [ "$status" = "active" ]; then echo "SYSD3$serv_name"; fi; done; done;