Browse Source

Improve vpn client checker

Julien Vaubourg 8 years ago
parent
commit
df431e8f78
2 changed files with 2 additions and 2 deletions
  1. 1 1
      conf/ynh-vpnclient-checker.sh
  2. 1 1
      sources/controller.php

+ 1 - 1
conf/ynh-vpnclient-checker.sh

@@ -1,6 +1,6 @@
 #!/bin/bash
 
-if [ ! -e /tmp/.ynh-vpnclient-stopped ] && ! ip link show tun0 &> /dev/null; then
+if [ ! -e /tmp/.ynh-vpnclient-stopped ] && ! ip route get 1.2.3.4 | grep -q tun0; then
   systemctl restart ynh-vpnclient &> /dev/null
 fi
 

+ 1 - 1
sources/controller.php

@@ -36,8 +36,8 @@ function stop_service() {
 }
 
 function start_service() {
-  unlink('/tmp/.ynh-vpnclient-stopped');
   exec('sudo systemctl start ynh-vpnclient', $output, $retcode);
+  unlink('/tmp/.ynh-vpnclient-stopped');
 
   return $retcode;
 }