[SOLVED] Restart OpenVPN via Cron Every Night
- 
 Hello, I have 2 OpenVPN servers setup and 2 OpenVPN clients setup. I would like cron to restart ovpnc2 cleint interface every night but I only would like that this interface to restart. Is there a command only target that one openvpn client? I found this command listed but I would guess that it restarts all the open servers and cleints? #!/usr/local/bin/php -q 
- 
 Here's the easiest way: First find the server you need to restart: : ps uxawww | grep openvpn 
 root 25984 0.0 0.9 13496 4340 ?? Ss Thu06PM 0:09.08 /usr/local/sbin/openvpn –config /var/etc/openvpn/server1.conf
 root 32393 0.0 0.9 13496 4492 ?? Ss Thu06PM 0:01.75 /usr/local/sbin/openvpn –config /var/etc/openvpn/server2.confThen run this script to restart just that one : /usr/local/sbin/pfSsh.php playback svc restart openvpn server 1 Starting the pfSense shell system…............ Attempting to issue restart to openvpn service... openvpn has been restarted. Note that only server 1 restarted: : ps uxawww | grep openvpn 
 root 32393 0.0 0.9 13496 4492 ?? Ss Thu06PM 0:01.75 /usr/local/sbin/openvpn –config /var/etc/openvpn/server2.conf
 root 32933 0.0 0.9 13496 4624 ?? Ss 4:18PM 0:00.00 /usr/local/sbin/openvpn –config /var/etc/openvpn/server1.conf
- 
 Perfect! Thanks jimp! 
- 
 While this was a great solution for my open VPN problem it made Avahi restart on pfsense even though it wasn't bound to openvpn interfaces and this caused homekit on ios / mac to often show accessories (in a different vlan and relying on avahi) as inaccessible for 20 + seconds after a restart upon first trying to use home app. 
- 
 @jim-coogan today i had OpenVPN service stopped after ISP restart (disconnection on WAN), and stay stopped for 12 hours. I had to go on-site to press start service again. Is there any way to cron restart services from pfsense ? 
- 
 @bambos yeah there is a cron package you can add in the package manager and then like this 2nd post here describes you can set it up to restart on whatever schedule you want. 
- 
 @jim-coogan thank you my friend. seems watchdog is easier package for that purpose, allows to monitor active services by selection and monitors, restarts, and notify without commands. Looks like a good start. Thank you for your comments. 
