Re: ppp check.
Kent perhaps you want something like this
#
#
###/etc/ppp/ip-up.d/up-time-sh####################
#!/bin/sh
rdate -s timelord.uregina.ca #use your own timeserver
echo -e "#\nOnline: `date`" >> /var/log//online
echo -e "`date +%s%t`\c" >> /var/log//online
##################################################
###/etc/ppp/ip-down/down-time-sh##################
#!/bin/sh
echo -e "`date +%s%n`" >> /var/log/online
##################################################
###/home/kent/online-time.pl######################
#!/usr/bin/perl -w
$datestring = "Online:";
$logfile = "/var/log/online";
$logline = "";
open (LOG, $logfile) or die "Couldn't open $logfile: $!";
while( <LOG> ){
next if m/^#/;
chomp;
if ( m/^$datestring/){
@logline = split " ";
$month = $logline[2];
($logline = <LOG>);
chomp $logline;
@logline = split "\t", $logline;
(@logline == 2) or die "time string error ";
$month{$month} +=int(($logline[1] - $logline[0] + 60) / 60);
}else{
print "\nerror in logfile";
}
}
foreach $month (keys %month){
$minutes = $month{$month};
print "Online time for $month: ", int($minutes / 60)," hours";
$minutes %= 60;
print " ", ($minutes), " minutes\n";
}
#################################################
###add to your bash_profile######################
perl ./online-time.pl
##################################################
On Thu, Apr 13, 2000 at 05:18:05AM +0200, Kjetil Thuen wrote:
> Kent Nyberg <vovin@footek.org> writes:
>
> > Is there a program to check how long one have been on ppp ?
> > I used a program in windows to check how long i have been on internet.. so
> > that i do not get to expensive bills :)
> > So i would like one for linux :)
>
> You might want to check out tcharge. It even calculates your phonebill
> for you. I don't think there are any debs available though..
>
> URL:http://hix.physik.uni-bremen.de/pub/Linux/tcharge/
>
> Kjetil
> --
> Quidquid latine dictum sit, altum viditur
> Finger stud2651@rasmus.uib.no for public PGP key.
Reply to: