I am running OpenVPN client on my dedicated server to connect the server to a private network. Last week, the service (i.e. OpenVPN) disconnected itself and we did not realise until our customers started to ring us. I don't know the reason why it disconnected, Now I want to set up email alert as soon as the OpenVPN disconnects. How can I do that ? Can anyone help please.
By the way, the server is running CentOS 6.8
Thank you.
Best Answer
I have successfully set up one myself with these three steps
Follow this or find your own guide to configure the script for email notification
Open
/etc/openvpn/server.conf
and append the following linesFinally
chmod 755 /path/to/script
Edit: Sorry, I misread your question. Add the two lines below to
client.conf
. This method is preferable over cronjob as it is almost instantaneous and doesn't flood you with mail