diff --git a/sats/gpio b/sats/gpio new file mode 100644 index 0000000..8f2d916 --- /dev/null +++ b/sats/gpio @@ -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; \ No newline at end of file diff --git a/sats/sysd b/sats/sysd new file mode 100644 index 0000000..be5a246 --- /dev/null +++ b/sats/sysd @@ -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; \ No newline at end of file diff --git a/sub-view/systemd b/sub-view/systemd new file mode 100755 index 0000000..a7f7e5c --- /dev/null +++ b/sub-view/systemd @@ -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; \ No newline at end of file