tpotce/installer/bin/dps.sh

43 lines
1.5 KiB
Bash
Raw Normal View History

2016-08-06 22:06:31 +00:00
#/bin/bash
# Let's ensure normal operation on exit or if interrupted ...
function fuCLEANUP {
stty sane
}
trap fuCLEANUP EXIT
2016-08-29 23:24:25 +00:00
stty -echo -icanon time 0 min 0
2017-04-30 23:34:30 +00:00
#myIMAGES=$(cat /etc/tpot/images.conf)
#myIMAGES=$(/usr/bin/docker ps -a -f name=$i --format "table {{.Names}}" | grep -v NAMES)
myIMAGES=$(cat /etc/tpot/tpot.yml | grep container_name | cut -d: -f2)
2016-08-15 05:46:57 +00:00
while true
do
clear
echo "======| System |======"
echo Date:" "$(date)
echo Uptime:" "$(uptime)
echo CPU temp: $(sensors | grep "Physical" | awk '{ print $4 }')
echo
2016-08-29 23:24:25 +00:00
echo "NAME CREATED PORTS"
for i in $myIMAGES; do
2017-04-30 23:34:30 +00:00
mySTATUS=$(/usr/bin/docker ps -f name=$i --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}" -f status=running -f status=exited | GREP_COLORS='mt=01;35' /bin/egrep --color=always "(^[_0-9a-z-]+ |$)|$" | GREP_COLORS='mt=01;32' /bin/egrep --color=always "(Up[ 0-9a-Z ]+ |$)|$" | GREP_COLORS='mt=01;31' /bin/egrep --color=always "(Exited[ \(0-9\) ]+ [0-9a-Z ]+ ago|$)|$" | tail -n 1)
myDOWN=$(echo "$mySTATUS" | grep -c "NAMES")
if [ "$myDOWN" = "1" ];
then
printf "%-19s Down\n" $i
else
printf "$mySTATUS\n"
fi
2016-08-29 23:24:25 +00:00
if [ "$1" = "vv" ];
then
/usr/bin/docker exec -t $i /bin/ps -awfuwfxwf | egrep -v -E "awfuwfxwf|/bin/ps"
fi
done
if [[ $1 =~ ^([1-9]|[1-9][0-9]|[1-9][0-9][0-9])$ ]];
then
sleep $1
else
break
fi
2016-08-15 05:46:57 +00:00
done