odw199 wrote: 
> I'll see if I can eliminate  the ntp requirement, but as I have a
> working implementation it'll be a while before I fiddle with it

I have never needed to do anything "extra" from the standard Pcp as
regards NTP

I wrote a script that starts the VPN and checks the VPN connection every
10 minutes. It restarts OpenVPN if the remote network cannot be
contacted.


Code:
--------------------
    #!/bin/sh
  
  sudo openvpn --config /home/tc/openvpn/config.conf &
  
  VPNTest() {
  
  #Check if the VPN is already being tested
  
  if [ -f /home/tc/TestingVPN ]; then
  echo "VPN is already being tested"
  else
  
  touch /home/tc/TestingVPN
  
  # Get Local network address
  
  homenet=$(/sbin/ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep 
-Eo '([0-9]*\.){2}[0-9]*' | grep -v '127.0.0')
  
  # Choose a host on the remote network
  
  testhost=192.168.5.2
  
  # If we can ping the host remote network then the VPN is up
  
  if [ "$homenet" != "192.168.5" ]; then
  count=$(ping -c 4 $testhost | grep 'received' | awk -F',' '{ print $2 }' | 
awk '{ print $1 }')
  if [ $count -eq 4 ]; then
  hostup=yes
  echo "VPN is UP"
  else
  
  echo "VPN is DOWN"
  echo "Restarting OpenVPN"
  
  sudo killall -HUP openvpn &
  
  sleep 20
  count=$(ping -c 4 $testhost | grep 'received' | awk -F',' '{ print $2 }' | 
awk '{ print $1 }')
  if [ $count -eq 4 ]; then
  echo "VPN is now up"
  else
  echo "VPN is still down will try again next time this script is run"
  fi
  fi            
          else
  # If we happen to be on the remote network without VPN
  
  echo "We're Home !"
  fi
  
  rm -f /home/tc/TestingVPN
  
  fi
  }
  
  while true
  do
  VPNTest
  sleep 600
  done
--------------------


I added this to user command 1


Code:
--------------------
    /home/tc/Startvpn.sh
--------------------


Seems to work fine



*Players:* SliMP3,Squeezebox3 x3,Receiver,SqueezePlayer,PiCorePlayer
x3,Wandboard
*Server:* LMS Version:  7.9.0 - 1475786002 on Centos 7 VM on ESXi 6 on
Dell T320
*Plugins:* AutoRescan/BBCiPlayer/PowerSave/PowerSwitchIII/Squeezecloud
*Remotes:* iPeng8/Orangesqueeze/PC/Jivelite
*Music:* 383GB,1269 albums 17756 songs 4381 artists mostly FLACs

*Want a webapp ?* See
http://forums.slimdevices.com/showthread.php?104305-Webapp-for-LMS
------------------------------------------------------------------------
Jeff07971's Profile: http://forums.slimdevices.com/member.php?userid=49290
View this thread: http://forums.slimdevices.com/showthread.php?t=106895

_______________________________________________
plugins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/plugins

Reply via email to