Skip to content

Instantly share code, notes, and snippets.

@idefux
Created June 23, 2015 06:27
Show Gist options
  • Save idefux/eacb3783487cfb2b6289 to your computer and use it in GitHub Desktop.
Save idefux/eacb3783487cfb2b6289 to your computer and use it in GitHub Desktop.
dd-wrt check if OpenVPN server is alive
#!/bin/sh
# This script checks if OpenVPN Server is alive.
# If not openpvn server will be started.
# Put this script in jffs/scripts/check_ovpn.sh.
# Call it via cron job (GUI -> Administration -> Management): */1 * * * * root /jffs/scripts/check_ovpn.sh
# This will trigger the script in 1 minute intervall.
OPENVPN_ALIVE=`ps | grep -v grep | grep -c "openvpn --daemon"`
if [ "$OPENVPN_ALIVE" -eq 0 ]; then
#echo "openvpn is down"
`openvpn --daemon --config /tmp/openvpn/openvpn.conf`
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment