Skip to content

Instantly share code, notes, and snippets.

@YUChoe
Created February 1, 2015 10:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save YUChoe/81883386b07d332d3249 to your computer and use it in GitHub Desktop.
Save YUChoe/81883386b07d332d3249 to your computer and use it in GitHub Desktop.
SSLVPN openvpn daemon watch
#!/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