How to know how long I connected to Internet?
How to know how long I connected to Internet?
I use kppp. I found kppp logs per months, but there is no any info. Is there exists any way to know it? |
there is an option of accounting in kppp
lookout there regards |
I tried, but probably Im too stupid :) But first I had a thought to make shell script. So now I want it no matter if kppp has it. But i need the next:
command to read a file (and if possible to read, e.g. only the 1st line of a file, or only the 2nd). Does such command exist? |
please elaborate more on what do u want to do
regards |
kppp has Execute tab to exec apps on connection/disconnction.
I want connect script: #!/bin/sh # (date +%k; date +%M; date +%m)> /apps/conscript/contime So this writes hour, min, month by different lines. And I want disconnect script (I dont know how to write it): #!/bin/sh # hour = NecessaryCmd (/apps/conscript/contime, line1) min = NecessaryCmd (/apps/conscript/contime, line2) month = NecessaryCmd (/apps/conscript/contime, line3) Then add hours, mins and so on, then write it to, say, /apps/conscript/stat Then see how much to pay :) Does such cmd exist? |
u need to wriote a scrpt on ur own
i do not think there is command for this at the maximum u can use the command "grep" for parsing some of the file regards |
I found how to read a file in cpp (Im a real fool in it). Here is my demo:
#include <fstream.h> #include <iostream.h> int main (int argc, char **argv) { char string[3]; char next; ifstream thefile; thefile.open("/apps/conscript/ass"); for (int i=0;i<3;i++) { thefile>>string; cout<<string; next=thefile.peek(); if (next=='\n') cout<<"\n"; } thefile.close(); return 0; } This doesnt do what I want, but... I think I will do it tomorrow (my time is GMT+7; its time to sleep now:)). May be I will post my all working (if they will) scripts and cpp apps. ______ Good night. :) |
u will learn more on this as u go on developing as u go more into this
regards |
does the command, "uptime" work?
|
uptime is for the system uptime i think
is it for the internet connection/devices also??? regards |
Quote:
|
Quote:
there are no arguments with uptime also only --v(version) regards |
couldn't you just run "date" at connect and at disconnect, in seconds format, subtract the two values, and divide to get mins, hrs (60, 3600, etc.)?
|
Hmm... great idea, but I almost completed work... but ALMOST! My cpp knowledge is VERY poor, but... I shoud do it. Someday :)
_______ Politics is supposed to be the second oldest profession. I have come to realize that it bears a very close resemblance to the first. -- Ronald Reagan |
If all you are wanting to know is how long you have been connected, try running the system monitor called gkrellm. It not only displays system info, but also displays connection speed, and time connected.
|
All times are GMT -5. The time now is 08:32 PM. |