docker-OpenVPN-server-stack/stop.sh

23 lines
375 B
Bash
Raw Normal View History

2019-12-31 19:46:17 +00:00
#!/bin/bash
sudo docker-compose kill -s SIGTERM
COUNT=1
ATTEMPT=0
while [ $COUNT -ne 0 ] && [ $ATTEMPT -lt 10 ]
do
sleep 1
COUNT=$(sudo docker-compose top | wc -l)
ATTEMPT=$(( $ATTEMPT + 1 ))
done
if [ $COUNT -eq 0 ]
then
sudo docker-compose down
exit 0
else
echo "ERROR: Some containers are still running"
sudo docker-compose ps
exit 1
fi