Improve vpn client checker
This commit is contained in:
parent
0ce8634736
commit
df431e8f78
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/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
|
systemctl restart ynh-vpnclient &> /dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -36,8 +36,8 @@ function stop_service() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function start_service() {
|
function start_service() {
|
||||||
unlink('/tmp/.ynh-vpnclient-stopped');
|
|
||||||
exec('sudo systemctl start ynh-vpnclient', $output, $retcode);
|
exec('sudo systemctl start ynh-vpnclient', $output, $retcode);
|
||||||
|
unlink('/tmp/.ynh-vpnclient-stopped');
|
||||||
|
|
||||||
return $retcode;
|
return $retcode;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user