Linux - GeneralThis 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
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.
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?
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?
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.