Checks for TUN device to be opened (useful after a reboot)

This commit is contained in:
Quentin McGaw
2018-09-21 17:00:52 +02:00
parent 2b7c7cc62a
commit cfd1bab58d

View File

@@ -1,9 +1,24 @@
#!/bin/sh #!/bin/sh
printf "=== PIA CONTAINER ===" printf "\n ========================================="
printf "\n ========================================="
printf "\n ============= PIA CONTAINER ============="
printf "\n ========================================="
printf "\n ========================================="
printf "\n == by github.com/qdm12 - Quentin McGaw ==\n"
cd /openvpn-$PROTOCOL-$ENCRYPTION cd /openvpn-$PROTOCOL-$ENCRYPTION
############################################
# CHECK FOR TUN DEVICE
############################################
while [ "$(cat /dev/net/tun 2>&1 /dev/null)" != "cat: read error: File descriptor in bad state" ];
do
printf "\nTUN device is not opened, sleeping for 30 seconds..."
sleep 30
done
printf "\nTUN device is opened"
############################################ ############################################
# ORIGINAL IP FOR HEALTHCHECK # ORIGINAL IP FOR HEALTHCHECK
############################################ ############################################