From a999bcf80bd3652bf7d6771038bb01ebe73b9251 Mon Sep 17 00:00:00 2001 From: Julien Vaubourg Date: Sun, 14 Aug 2016 22:57:48 +0200 Subject: [PATCH] Ok guys, all of this is very crappy, but u know, we do the best --- conf/ynh-vpnclient-checker.sh | 2 +- sources/controller.php | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/conf/ynh-vpnclient-checker.sh b/conf/ynh-vpnclient-checker.sh index cc4e2d1..c5b5dde 100644 --- a/conf/ynh-vpnclient-checker.sh +++ b/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 diff --git a/sources/controller.php b/sources/controller.php index c6e158e..e399c37 100644 --- a/sources/controller.php +++ b/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;