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;