how to check for pptp vpn client status and restart it?
#!/bin/sh
IFNAME="ppp5"
PASSWD="password"
USERNAME="uuuuuuuu"
SERVER="url.server.pptp"
PROTOCOL="PPTP" # PPTP or L2TP
nvram set vpnc_proto=$(echo $PROTOCOL | tr '[A-Z]' '[a-z]') # Must be lowercase?, but Profile uses uppercase?
nvram set vpnc_heartbeat_x=$SERVER
nvram set vpnc_pppoe_passwd=$PASSWD
nvram set vpnc_pppoe_username=$USERNAME
nvram set vpnc_dnsenable_x="1"
nvram set vpnc_pptp_options_x=
if [ "$PROTOCOL" == "PPTP" ];then # Only required for PPTP?
nvram set vpnc_pptp_options_x="+mppe-128"
fi
# Restart ACTIVE PPTP/L2TP client
if [ "$(nvram get vpnc_state_t)" == "2" ] || [ ! -z "$(ifconfig $IFNAME 2> /dev/null | grep -o "UP")" ];then
service restart_vpncall
fi
Thank You!Something like this?
Code:#!/bin/sh IFNAME="ppp5" PASSWD="password" USERNAME="uuuuuuuu" SERVER="url.server.pptp" PROTOCOL="PPTP" # PPTP or L2TP nvram set vpnc_proto=$(echo $PROTOCOL | tr '[A-Z]' '[a-z]') # Must be lowercase?, but Profile uses uppercase? nvram set vpnc_heartbeat_x=$SERVER nvram set vpnc_pppoe_passwd=$PASSWD nvram set vpnc_pppoe_username=$USERNAME nvram set vpnc_dnsenable_x="1" nvram set vpnc_pptp_options_x= if [ "$PROTOCOL" == "PPTP" ];then # Only required for PPTP? nvram set vpnc_pptp_options_x="+mppe-128" fi # Restart ACTIVE PPTP/L2TP client if [ "$(nvram get vpnc_state_t)" == "2" ] || [ ! -z "$(ifconfig $IFNAME 2> /dev/null | grep -o "UP")" ];then service restart_vpncall fi
Welcome To SNBForums
SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.
If you'd like to post a question, simply register and have at it!
While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!