Browse Source

sh script to check

master
gsd 6 months ago
parent
commit
a21bac599e
  1. 1
      docker-compose.yaml
  2. 22
      upcheck.sh

1
docker-compose.yaml

@ -36,6 +36,7 @@ services:
restart: unless-stopped
proxywg_client:
container_name: proxywg_client
image: wireguard:clear
cap_add:
- NET_ADMIN

22
upcheck.sh

@ -0,0 +1,22 @@
#!/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
Loading…
Cancel
Save