Browse Source

check fix

master
gsd 6 months ago
parent
commit
77c1cf22a6
  1. 26
      upcheck.sh

26
upcheck.sh

@ -11,12 +11,22 @@ if [ "$CHECK_CONTAINER" == "0" ]; then
exit 0
fi
RESULT="$(docker exec -it $CONTAINER ping -c 1 -W 1 $PINGHOST > /dev/null && echo 'pass' || echo 'fail')"
#echo $RESULT
COUNT=0
MAXPING=30
if [ "$RESULT" != "pass" ]; then
echo 'container is not good'
docker compose down
docker compose up -d
exit 0
fi
while [ $COUNT -le $MAXPING ]
do
COUNT=`expr $COUNT + 1`
RESULT="$(docker exec -it $CONTAINER ping -c 1 -W 1 $PINGHOST > /dev/null && echo 'pass' || echo 'fail')"
if [ "$RESULT" == "pass" ]; then
exit 0
fi
if [ $COUNT -ge 29 ]; then
echo 'container is not good'
docker compose down
docker compose up -d
exit 0
fi
done

Loading…
Cancel
Save