Updated 'view systemd' display (colors, etc) + updated 'sats.sysd' to manage "all" services not only the ones which have an existing file (so it adds instances)
This commit is contained in:
parent
6a83f4021a
commit
c45e24c1da
|
@ -16,13 +16,12 @@ source $ROOT/com/config_sats;
|
||||||
|
|
||||||
# (2) Start daemon
|
# (2) Start daemon
|
||||||
#--------------------------------------------------------#
|
#--------------------------------------------------------#
|
||||||
SERV_LIST="ls /lib/systemd/system/sats-*";
|
SERV_LIST="`systemctl list-units --plain | grep 'sats' | grep -v '.slice' | awk '{print $1}'`";
|
||||||
while sleep 1; do
|
while sleep 1; do
|
||||||
|
|
||||||
for i in $SERV_LIST; do
|
for serv in $SERV_LIST; do
|
||||||
|
|
||||||
status="`systemctl is-active $(basename $i)`";
|
status="`systemctl is-active $(basename $serv)`";
|
||||||
serv="`basename $i`";
|
|
||||||
|
|
||||||
if [ "$status" = "failed" ]; then
|
if [ "$status" = "failed" ]; then
|
||||||
echo "SYSD0$serv" >> $BUF_OUT;
|
echo "SYSD0$serv" >> $BUF_OUT;
|
||||||
|
|
|
@ -29,15 +29,30 @@ while sleep 1; clear; do
|
||||||
# (5) Store each service #
|
# (5) Store each service #
|
||||||
while IFS= read -r line; do
|
while IFS= read -r line; do
|
||||||
|
|
||||||
SERV["${line:1}"]="${line:0:1}";
|
test "`echo -ne $line | wc -m`" -ge 5 && SERV["${line:1}"]="${line:0:1}";
|
||||||
|
|
||||||
done <<< "$SERV_LIST";
|
done <<< "$SERV_LIST";
|
||||||
|
|
||||||
# (6) Display each service #
|
# (6) Display each service #
|
||||||
for s in "${!SERV[@]}"; do
|
for s in "${!SERV[@]}"; do
|
||||||
|
|
||||||
|
# if failed -> red
|
||||||
|
if [ "${SERV[$s]}" = "0" ]; then
|
||||||
|
echo -e "(${SERV[$s]}) \e[31m$s\e[0m";
|
||||||
|
|
||||||
|
# if activating -> orange
|
||||||
|
elif [ "${SERV[$s]}" = "2" ]; then
|
||||||
|
echo -e "(${SERV[$s]}) \e[33m$s\e[0m";
|
||||||
|
|
||||||
# if active -> green
|
# if active -> green
|
||||||
test "${SERV[$s]}" = "1" && echo -e "\e[32m$s\e[0m" || echo -e "\e[0m$s\e[0m";
|
elif [ "${SERV[$s]}" = "3" ]; then
|
||||||
|
echo -e "(${SERV[$s]}) \e[32m$s\e[0m";
|
||||||
|
|
||||||
|
# if inactive -> grey
|
||||||
|
else
|
||||||
|
echo -e "(${SERV[$s]}) \e[90m$s\e[0m";
|
||||||
|
|
||||||
|
fi;
|
||||||
|
|
||||||
done;
|
done;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue