Created
February 1, 2015 10:58
-
-
Save YUChoe/81883386b07d332d3249 to your computer and use it in GitHub Desktop.
SSLVPN openvpn daemon watch
This file contains hidden or 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 | |
installDir="{{MASK}}" | |
LOG="{{MASK}}" | |
RUN="/usr/sbin/openvpn --config $installDir/etc/openvpn/server.conf --cd $installDir/etc/openvpn" | |
echo "`date` starting... watching sslvpn daemon" >> $LOG | |
while true; | |
do | |
PID=`cat $installDir/etc/openvpn/server.pid 2> /dev/null` | |
if ! kill -0 $PID > /dev/null 2>&1; then | |
echo "`date` openvpn $PID died" >> $LOG | |
`$RUN` | |
sleep 30 | |
PID=`cat $installDir/etc/openvpn/server.pid 2> /dev/null` | |
echo "`date` openvpn running $PID" >> $LOG | |
fi | |
sleep 30 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment