Jump to content
View in the app

A better way to browse. Learn more.

Pulseway

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted
test_address="8.8.8.8"                                          
tunnel_interfaceWAN="eth0"                                      
tunnel_interfaceVPN="tun1"                                      
init_ping_tries=2    

ping_tries=init_ping_tries
WANup=0

while  [[ $ping_tries -lt 5] && [ $WANup -eq 0 ]]
do
        if ping -c 1 -W 1 $test_address -I $tunnel_interfaceWAN >/dev/null
  then
                WANup=1
        fi
        ping_tries=$((ping_tries+1))
done

if $WANup -eq 0
  then
        echo "VPN is down because Internet is down [exit 0]"
        exit 0
fi

Im pretty new to bash programming, this script should be simple, but I cant seem to figure out why it is not working correctly.

Is there something wrong with the syntax of my while loop or last if statement?

 

Edited by JackNY

Create an account or sign in to comment

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.