[mdlug] Serial port monitoring

Joseph C. Bender jcbender at bendorius.com
Sun Feb 3 13:34:54 EST 2008


Drew wrote:

>      What I'm after is something that will automatically keep count of how many
> minutes I've been connected to Netzero dialup during the month, without my
> having to remember to do anything special before starting it up. I only get 10
> hours a month, and they don't seem willing to provide a way to determine how
> much time is left.
> 
	Well, now that you've defined the problem domain, this might easier to 
solve than you might think.

	Take a look at the pppd manpage, and the "SCRIPTS" section.

	There's a environment variable called "CONNECT_TIME", which, per the 
manpage is defined as:

"The number of seconds from when the PPP negotiation started until the 
connection was terminated."

This variable gets set when the connection is terminated and PPP runs 
one of its standard scripts.  You could probably call something from the 
/etc/ppp/ip-down or auth-down scripts when the ppp link goes down to 
read that variable (or pass it as a parameter) to do the link time 
accounting that you're trying to do based on that number of seconds.

	While the serial port method would probably be workable in the end, 
having pppd log things after disconnect may be the least painful way to 
do what you're trying to do.


-- 
Joseph Bender
Bendorius Consulting
P: 248-434-5580
F: 248-434-5581
jcbender at bendorius com



More information about the mdlug mailing list