Last active
June 17, 2018 12:18
-
-
Save tbalthazar/8d14dba0fdc76bf31f981c94781ec7a3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# 1. Download this script in /root/neutrinet-connectivity-fix.sh | |
# 2. chmod +x neutrinet-connectivity-fix.sh | |
# 3. echo "*/5 * * * * root /sbin/ifconfig tun0 > /dev/null 2>&1 || /root/neutrinet-connectivity-fix.sh > /dev/null 2>&1" > /etc/cron.d/restart_vpn | |
# 4. This file should contain: | |
# * * * * * root /sbin/ifconfig tun0 > /dev/null 2>&1 || /root/neutrinet-connectivity-fix.sh | |
# Remark: test cron job by doing: run-parts -v /etc/cron.d | |
echo "stopping firewall..." | |
systemctl stop yunohost-firewall.service | |
echo "firewall stopped" | |
echo "setting nameserver..." | |
echo "nameserver 80.67.169.40" > /etc/resolv.conf | |
echo "nameserver set." | |
echo "restarting ntp..." | |
systemctl restart ntp | |
echo "ntp restarted." | |
echo "synchronise time..." | |
sntp pool.ntp.org | |
echo "new time set." | |
echo "restarting vpn client..." | |
systemctl restart ynh-vpnclient | |
echo "vpn client restarted." | |
echo "waiting 5 seconds..." | |
sleep 5 | |
echo "starting firewall..." | |
systemctl start yunohost-firewall.service | |
echo "firewall started." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ça génère des mail de cron toutes les minutes 🤕 !
Pour y remédier je propose:
De remplacer
Par
3. echo "*/5 * * * * root /sbin/ifconfig tun0 > /dev/null 2>&1 || /root/neutrinet-connectivity-fix.sh > /dev/null 2>&1" > /etc/cron.d/restart_vpn
Pour ne pas être alerté par mail et réduire la fréquence parce que parfois ça prend plus d'une minute pour être résolu et que c'est pas indispensable de le faire à chaque minute.
Et pour le temps je propose: