Restarting OpenVPN with cron job
-
Hello,
I am using the openvpn client with a vpn service provider. The client at some point in time is failing to resolve the DNS name of the server. It works when i restart the client and/or reboot the pfsense. I do not know what is causing it.
I want to set a cron job using the cron package to restart the OpenVPN client at midnight. So far I configured what is in screen shot 1. It uses the following command:
echo "" | php -q
But when I save it, it show up as screenshot too. When I go to edit it again it seems like the entire command is there. I am not an expert with the CLI so did I put the command in correctly? (note i have this cron job to go every 3 minutes because I just wanted to see if it worked.)
Any help will be appreciated.



 -
Don't use PHP there. You can use the shell command to restart the instance.
/usr/local/sbin/pfSsh.php playback svc restart openvpn client x
Where "x" is the id of the OpenVPN instance (e.g. ovpnc2 would be id 2)
-
Thank you!
-
Don't use PHP there. You can use the shell command to restart the instance.
/usr/local/sbin/pfSsh.php playback svc restart openvpn client x
Where "x" is the id of the OpenVPN instance (e.g. ovpnc2 would be id 2)
Is there an easy way to do this for all running clients?
My end goal is to have active OpenVPN clients restart on a schedule without pointlessly attempting to restart disabled clients using a for loop.
-
No, there is no built-in way to do that for all instances.
-
I tried this command
"/usr/local/sbin/pfSsh.php playback svc restart openvpn client 1"and now I can't login to the web interface, not even after restart.
any tips for me? :P