标签:
/etc/ppp/ip-up
#!/bin/bash # This file should not be modified -- make local changes to # /etc/ppp/ip-up.local instead PATH=/sbin:/usr/sbin:/bin:/usr/bin export PATH log=/var/log/tmp.log echo "##################################" >> $log echo "Now User $PEERNAME is connected!!!" >> $log echo "##################################" >> $log echo "time: `date -d today +%F_%T`" >> $log echo "clientIP: $6" >> $log echo "username: $PEERNAME" >> $log echo "device: $1" >> $log echo "vpnIP: $4" >> $log echo "assignIP: $5" >> $log LOGDEVICE=$6 REALDEVICE=$1 [ -f /etc/sysconfig/network-scripts/ifcfg-${LOGDEVICE} ] && /etc/sysconfig/network-scripts/ifup-post --realdevice ${REALDEVICE} ifcfg-${LOGDEVICE} /etc/ppp/ip-up.ipv6to4 ${LOGDEVICE} [ -x /etc/ppp/ip-up.local ] && /etc/ppp/ip-up.local "$@" exit 0
/etc/ppp/ip-down
#!/bin/bash # This file should not be modified -- make local changes to # /etc/ppp/ip-down.local instead PATH=/sbin:/usr/sbin:/bin:/usr/bin export PATH log=/var/log/tmp.log echo "#####################################" >> $log echo "Now User $PEERNAME is disconnected!!!" >> $log echo "#####################################" >> $log echo "time: `date -d today +%F_%T`" >> $log echo "clientIP: $6" >> $log echo "username: $PEERNAME" >> $log echo "device: $1" >> $log echo "vpnIP: $4" >> $log echo "assignIP: $5" >> $log echo "connect time: $CONNECT_TIME s" >> $log echo "bytes sent: $BYTES_SENT B" >> $log echo "bytes rcvd: $BYTES_RCVD B" >> $log sum_bytes=$(($BYTES_SENT+$BYTES_RCVD)) sum=`echo "scale=2;$sum_bytes/1024/1024"|bc` echo "bytes sum: $sum MB" >> $log ave=`echo "scale=2;$sum_bytes/1024/$CONNECT_TIME"|bc` echo "average speed: $ave KB/s" >> $log LOGDEVICE=$6 REALDEVICE=$1 /etc/ppp/ip-down.ipv6to4 ${LOGDEVICE} [ -x /etc/ppp/ip-down.local ] && /etc/ppp/ip-down.local "$@" /etc/sysconfig/network-scripts/ifdown-post --realdevice ${REALDEVICE} ifcfg-${LOGDEVICE} exit 0
标签:
原文地址:http://www.cnblogs.com/cmsd/p/5196204.html