Finished 'view systemd' + added sats.* scripts
This commit is contained in:
parent
ee367756f5
commit
7fd8d18f63
|
@ -0,0 +1,23 @@
|
|||
#!/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
|
||||
#--------------------------------------------------------#
|
||||
while sleep 1; do
|
||||
|
||||
$ROOT/com/write sats "`cat /home/sats/satsd/conf/machine.state`\n";
|
||||
|
||||
done;
|
|
@ -0,0 +1,24 @@
|
|||
#!/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 test "`systemctl is-active $(basename $i)`" = "active" && echo "SYSD1`basename $i`" >> $BUF_OUT || echo "SYSD0`basename $i`" >> $BUF_OUT; done;
|
||||
|
||||
done;
|
|
@ -0,0 +1,46 @@
|
|||
#!/bin/bash
|
||||
|
||||
|
||||
# (1) Primary init.
|
||||
#--------------------------------------------------------#
|
||||
# (1) Get absolute folder #
|
||||
ROOT=$(dirname `realpath $0`);
|
||||
ROOT=`dirname $ROOT`;
|
||||
|
||||
# (2) Check lock file #
|
||||
test ! -f $ROOT/.lock && echo "Daemon not started" && exit 1;
|
||||
|
||||
|
||||
|
||||
# (2) While viewing loop
|
||||
#--------------------------------------------------------#
|
||||
# (1) Initialise vars #
|
||||
declare -A SERV;
|
||||
|
||||
# (2) Get BUF_IN #
|
||||
source $ROOT/com/config_ioemu;
|
||||
|
||||
# (3) For each service update #
|
||||
while sleep 1; clear; do
|
||||
|
||||
# (4) Get last value from lines beginning by 'GSTA' #
|
||||
SERV_LIST="`cat $BUF_IN | grep -Po "^SYSD(.+)$" | sed 's/^SYSD\(.\+\)$/\1/g' | tail -n20`";
|
||||
|
||||
# (5) Store each service #
|
||||
while IFS= read -r line; do
|
||||
|
||||
SERV["${line:1}"]="${line:0:1}";
|
||||
|
||||
done <<< "$SERV_LIST";
|
||||
|
||||
# (6) Display each service #
|
||||
for s in "${!SERV[@]}"; do
|
||||
|
||||
# if active -> green
|
||||
test "${SERV[$s]}" = "1" && echo -e "\e[32m$s\e[0m" || echo -e "\e[0m$s\e[0m";
|
||||
|
||||
done;
|
||||
|
||||
|
||||
|
||||
done;
|
Loading…
Reference in New Issue