Browse Source

Ok guys, all of this is very crappy, but u know, we do the best

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

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

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

+ 2 - 0
sources/controller.php

@@ -31,10 +31,12 @@ function ynh_setting_set($setting, $value) {
 }
 
 function stop_service() {
+  touch('/tmp/.ynh-vpnclient-stopped');
   exec('sudo systemctl stop ynh-vpnclient');
 }
 
 function start_service() {
+  unlink('/tmp/.ynh-vpnclient-stopped');
   exec('sudo systemctl start ynh-vpnclient', $output, $retcode);
 
   return $retcode;