LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-20-2005, 09:43 AM   #1
kornerr
Member
 
Registered: Dec 2004
Location: Russia, Siberia, Kemerovo
Distribution: Slackware
Posts: 893

Rep: Reputation: 35
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?
 
Old 01-20-2005, 10:14 AM   #2
masand
LQ Guru
 
Registered: May 2003
Location: INDIA
Distribution: Ubuntu, Solaris,CentOS
Posts: 5,522

Rep: Reputation: 69
there is an option of accounting in kppp
lookout there

regards
 
Old 01-20-2005, 10:52 AM   #3
kornerr
Member
 
Registered: Dec 2004
Location: Russia, Siberia, Kemerovo
Distribution: Slackware
Posts: 893

Original Poster
Rep: Reputation: 35
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?
 
Old 01-20-2005, 11:03 AM   #4
masand
LQ Guru
 
Registered: May 2003
Location: INDIA
Distribution: Ubuntu, Solaris,CentOS
Posts: 5,522

Rep: Reputation: 69
please elaborate more on what do u want to do

regards
 
Old 01-20-2005, 11:11 AM   #5
kornerr
Member
 
Registered: Dec 2004
Location: Russia, Siberia, Kemerovo
Distribution: Slackware
Posts: 893

Original Poster
Rep: Reputation: 35
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?
 
Old 01-20-2005, 11:35 AM   #6
masand
LQ Guru
 
Registered: May 2003
Location: INDIA
Distribution: Ubuntu, Solaris,CentOS
Posts: 5,522

Rep: Reputation: 69
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
 
Old 01-20-2005, 12:38 PM   #7
kornerr
Member
 
Registered: Dec 2004
Location: Russia, Siberia, Kemerovo
Distribution: Slackware
Posts: 893

Original Poster
Rep: Reputation: 35
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.
 
Old 01-20-2005, 12:57 PM   #8
masand
LQ Guru
 
Registered: May 2003
Location: INDIA
Distribution: Ubuntu, Solaris,CentOS
Posts: 5,522

Rep: Reputation: 69
u will learn more on this as u go on developing as u go more into this

regards
 
Old 01-20-2005, 01:57 PM   #9
stakhous
Member
 
Registered: May 2003
Location: PA
Posts: 82

Rep: Reputation: 15
does the command, "uptime" work?
 
Old 01-20-2005, 02:12 PM   #10
masand
LQ Guru
 
Registered: May 2003
Location: INDIA
Distribution: Ubuntu, Solaris,CentOS
Posts: 5,522

Rep: Reputation: 69
uptime is for the system uptime i think
is it for the internet connection/devices also???

regards
 
Old 01-20-2005, 02:47 PM   #11
rsmccain
Member
 
Registered: Apr 2004
Location: Louisiana
Distribution: SUSE
Posts: 154

Rep: Reputation: 30
Quote:
Originally posted by masand
uptime is for the system uptime i think
is it for the internet connection/devices also???

regards
uptime is only for system uptime. It's unrelated to internet connectivity.
 
Old 01-20-2005, 02:57 PM   #12
masand
LQ Guru
 
Registered: May 2003
Location: INDIA
Distribution: Ubuntu, Solaris,CentOS
Posts: 5,522

Rep: Reputation: 69
Quote:
Originally posted by rsmccain
uptime is only for system uptime. It's unrelated to internet connectivity.
thats what i mentioned!!!!

there are no arguments with uptime also
only --v(version)

regards
 
Old 01-20-2005, 04:16 PM   #13
Genesee
Member
 
Registered: Dec 2002
Distribution: Slackware
Posts: 927

Rep: Reputation: 30
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.)?
 
Old 01-21-2005, 09:49 AM   #14
kornerr
Member
 
Registered: Dec 2004
Location: Russia, Siberia, Kemerovo
Distribution: Slackware
Posts: 893

Original Poster
Rep: Reputation: 35
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
 
Old 01-21-2005, 07:57 PM   #15
dylbyrt45
Member
 
Registered: Sep 2003
Location: Dallas
Distribution: Suse 9.1 pro
Posts: 37

Rep: Reputation: 15
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Oh my. No internet connected? ElvenAssassin Linux - Newbie 8 04-25-2005 01:17 PM
How can I get connected to Internet in... mir_sheely Linux - Hardware 1 06-11-2004 05:16 AM
help getting connected to internet leroy27336 Linux - Networking 2 01-22-2004 03:59 AM
Cannot get connected to the internet ullfrigg Linux - Networking 5 11-22-2003 02:47 PM
internet is connected but cannot browse internet?!?!? myk3 Linux - Newbie 3 11-17-2003 05:57 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration