#!/bin/bash
#
#This program is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 2 of the License, or
#(at your option) any later version.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU General Public License
#along with this program; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA


now=`date +%s`
connect_date=`ls -l --time-style=+%s /var/run/pppoe.conf-adsl.pid.pppd | awk '{ print $6 }'`
secs=`calc $now - $connect_date | awk '{ print $1 }'`
cat /var/log/ppp-uptime-log | grep -vE "^$connect_date\|" > /var/log/ppp-uptime-log2
echo "$connect_date|$secs" >> /var/log/ppp-uptime-log2
mv /var/log/ppp-uptime-log2 /var/log/ppp-uptime-log
