#!/bin/bash cd "$(dirname "$0")" CONTAINER=proxywg_socks_c PINGHOST=8.8.8.8 CHECK_CONTAINER="$(docker ps | grep $CONTAINER | wc -l)" if [ "$CHECK_CONTAINER" == "0" ]; then echo 'container is not started' docker compose up -d exit 0 fi RESULT="$(docker exec -it $CONTAINER ping -c 1 -W 1 $PINGHOST > /dev/null && echo 'pass' || echo 'fail')" #echo $RESULT if [ "$RESULT" != "pass" ]; then echo 'container is not good' docker compose down docker compose up -d exit 0 fi