From cfd1bab58d02b89449d68902137f2fff03751924 Mon Sep 17 00:00:00 2001 From: Quentin McGaw Date: Fri, 21 Sep 2018 17:00:52 +0200 Subject: [PATCH] Checks for TUN device to be opened (useful after a reboot) --- entrypoint.sh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 1bc1471c..fff58fb6 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,9 +1,24 @@ #!/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 +############################################ +# 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 ############################################