Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
A simple script which compares the current time and the time stamp of when it connected should work. When ppp connects it should send some kind of message to syslog. You can get the last connection line from the log file. And then compare it with the current time to figure out how long you've been online.
You could also add a simple command which places the timestamp in a file when you connect. Maybe something like:
date > /var/run/pppconnected
Distribution: Mandrake, Xandros, and Debian 3.0 (Woody) as a proxy
Posts: 103
Original Poster
Rep:
Quote:
Originally posted by Mik A simple script which compares the current time and the time stamp of when it connected should work. When ppp connects it should send some kind of message to syslog. You can get the last connection line from the log file. And then compare it with the current time to figure out how long you've been online.
You could also add a simple command which places the timestamp in a file when you connect. Maybe something like:
date > /var/run/pppconnected
Mik thanks. I had thought of that I just figured there was something easier or better that was already done. How does PPP know how long it's been connected? If I loose connection, or the peer drops on me it reports how long I was connected in syslog. How does it know? If it knows isn't there some way that I could get it to tell me that. I can get it to tell me stats like how many packets it's sent/recieved.
I suppose it probably keeps an internal timer of how long it has been connected. I've never used ppp so I wouldn't know if it's possible to get that information. I'd say maybe check the manpages for something like that.
But it shouldn't be to hard to write a simple script. You can easily extract the timestamp from the log file by doing something like:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.