Files
tpotce/installer/bin/check.sh

42 lines
1.1 KiB
Bash
Raw Normal View History

2015-01-27 17:46:52 +01:00
#!/bin/bash
########################################################
2015-12-08 15:47:39 +01:00
# T-Pot #
2015-01-27 17:46:52 +01:00
# Check container and services script #
# #
2016-05-12 19:26:06 +02:00
# v16.10.0 by mo, DTAG, 2016-05-12 #
2015-01-27 17:46:52 +01:00
########################################################
2015-01-30 21:40:01 +01:00
if [ -a /var/run/check.lock ];
2016-03-09 14:05:06 +01:00
then
echo "Lock exists. Exiting now."
exit
2015-01-27 17:46:52 +01:00
fi
myIMAGES=$(cat /etc/tpot/images.conf)
2015-01-28 17:08:34 +01:00
2015-01-27 17:46:52 +01:00
touch /var/run/check.lock
myUPTIME=$(awk '{print int($1/60)}' /proc/uptime)
2015-01-28 17:08:34 +01:00
for i in $myIMAGES
2015-08-07 22:32:15 +02:00
do
if [ "$i" != "ui-for-docker" ] && [ "$i" != "netdata" ] && [ "$i" != "spiderfoot" ];
then
myCIDSTATUS=$(docker exec $i supervisorctl status)
if [ $? -ne 0 ];
then
myCIDSTATUS=1
else
myCIDSTATUS=$(echo $myCIDSTATUS | egrep -c "(STOPPED|FATAL)")
fi
if [ $myUPTIME -gt 4 ] && [ $myCIDSTATUS -gt 0 ];
then
echo "Restarting "$i"."
systemctl stop $i
sleep 5
systemctl start $i
fi
fi
2015-01-27 17:46:52 +01:00
done
2016-03-09 14:05:06 +01:00
2015-01-27 17:46:52 +01:00
rm /var/run/check.lock