Скрипт запускающийся во время поднятия интерфейса при vpn подключении

[admin@pfsense.baza-kps.alx]/root: cat /usr/local/sbin/vpn-linkup
#!/bin/sh
 
make_route() {
    LOG=/var/log/vpn_test.log
    CURDATE=`date "+%Y-%m-%d %H:%M"`
 
    case $1 in
	192.168.0.171)
	    route add -net 192.168.5.0/24 $1
	    echo "${CURDATE} add -net 192.168.5.0/24 $1" >> ${LOG}
	    ;;
 
	192.168.0.172)
	    echo "${CURDATE} $1" >> ${LOG}
	    ;;
 
	192.168.0.173)
	    echo "${CURDATE} $1" >> ${LOG}
	    ;;
 
	192.168.0.174)
	    echo "${CURDATE} $1" >> ${LOG}
	    ;;
 
	192.168.0.175)
	    echo "${CURDATE} $1" >> ${LOG}
	    ;;
 
	192.168.0.176)
	    echo "${CURDATE} $1" >> ${LOG}
	    ;;
 
	192.168.0.177)
	    echo "${CURDATE} $1" >> ${LOG}
	    ;;
    esac
}
 
# record login
/usr/bin/logger -p local3.info "login,$1,$4,$5"
 
case `/bin/echo $1 | /usr/bin/cut -c1-4` in
	pptp)
		/sbin/ifconfig $1 group pptp
		make_route $4
		;;
	poes)
		/sbin/ifconfig $1 group pppoe
		;;
	l2tp)
		/sbin/ifconfig $1 group l2tp
		;;
esac