[Not Solved]
Aug 14, 2015, 03:59 AM
(This post was last modified: Aug 17, 2015, 07:55 AM by Desgyz.)
If anyone is interested in the script.
Monitor linux openvpn daemon and restart if disconnected
1. Create file in location /etc/openvpn:
2. Add the bash script:
Thanks to.
http://support.vpnsecure.me/articles/fre...sconnected
[save and exit]
Location of the file:
3. Make the file executable:
4.(Make sure you have crontabs package installed.)
5. Add this line below the # tag att the bottom: (it will run the script every hour)
[save and exit]
Info
*/5 * * * * /path/to/script - (it will run the script every 5 min)
*/30 * * * * /path/to/script - (it will run the script every 30 min)
Crontab logs its actions to Syslog:
Fix this error message in the syslog (No MTA installed, discarding output)
Install it for local use only, I named the server raspberrypi
Big thanks to Desgyz and Mike who helped med with creating it.
Please feel free to post if you find any errors or modifications which would improve the script.
Monitor linux openvpn daemon and restart if disconnected
1. Create file in location /etc/openvpn:
Code:
sudo nano /etc/openvpn/checkopenvpn.sh
2. Add the bash script:
Code:
#!/bin/bash
ps -ef | grep -v grep | grep openvpn
if [ $? -eq 1 ] ; then
/usr/sbin/openvpn --config username.ovpn --daemon --script-security 3 system
fi
http://support.vpnsecure.me/articles/fre...sconnected
[save and exit]
Location of the file:
Code:
/etc/openvpn/checkopenvpn.sh
3. Make the file executable:
Code:
sudo chmod +x /etc/openvpn/checkopenvpn.sh
4.(Make sure you have crontabs package installed.)
Code:
sudo crontab -e
5. Add this line below the # tag att the bottom: (it will run the script every hour)
Code:
0 * * * * /etc/openvpn/checkopenvpn.sh
Info
*/5 * * * * /path/to/script - (it will run the script every 5 min)
*/30 * * * * /path/to/script - (it will run the script every 30 min)
Crontab logs its actions to Syslog:
Code:
sudo grep CRON /var/log/syslog
Fix this error message in the syslog (No MTA installed, discarding output)
Code:
sudo apt-get install postfix
Install it for local use only, I named the server raspberrypi
Big thanks to Desgyz and Mike who helped med with creating it.
Please feel free to post if you find any errors or modifications which would improve the script.