|
The question of inactivity timeout for PPP sessions has arisen again.
The following script is what they used under SunOS, which doesn't
work under DU. Does anyone have a script or another solution that will
provide the desired functionality?
# !/bin/sh
# Check and kill the inactive pppd lines
# Remove old tmp files
[ `date '+%H'` -eq 6 ] && (cd /tmp; find . -name "x29*" -atime 1 -exec
rm {} \;)
pids=`/bin/ps -a|/bin/grep x29|/bin/grep -v grep|grep -v yaron|/bin/awk
'{print$1}'`
for pid in `echo $pids`
do
if [ -f /tmp/x29.$pid ]
then
old_rcv=`/bin/cat /tmp/x29.$pid`
else
old_rcv=0
fi
new_rcv=`/usr/etc/pstat -u $pid | /bin/grep msgsnd | /bin/awk
'$8> 0 {print
$8}'`
diff_rcv=`/bin/expr $new_rcv - $old_rcv`
if [ "$diff_rcv" -gt "0" ]
then
/bin/echo $new_rcv >/tmp/x29.$pid
else
in_line=`/bin/ps $pid|/bin/grep -v PID|/bin/awk '{print
$2}'`
/usr/etc/fuser -ku /dev/tty$in_line
fi
done
|