Robert Heffernan wrote:
>> another one for you scripting people, if you would
>> the command pppstats gives various statistics about what pppd has been doing
> (as I'm sure you all know, and as the nae would suggest)
> I want to be able to have a script that would tell me only two of these
> stastics - the number of bytes sent and the number recieved.
> How would I do this?
>> also - having been used to connecting to the net via windows I'm used to
> knowing the connection speed. Is there any way of finding out what speed
> connection to the net pppd has established?
>> Also - how does one find out your ip address on the net?
Everything is in /var/log/syslog :
You can see That I was connected at 48000 baud. and my IP address was :
193.250.90.34
I use the pon/poff script to connect. For the connection time, I have
written a little script to make the sum of all connection times over the
month.
Sep 8 11:00:49 islay pppd[17104]: pppd 2.4.1 started by jerome, uid
1000
Sep 8 11:00:50 islay chat[17106]: abort on (BUSY)
Sep 8 11:00:50 islay chat[17106]: abort on (NO CARRIER)
Sep 8 11:00:50 islay chat[17106]: abort on (VOICE)
Sep 8 11:00:50 islay chat[17106]: abort on (NO DIALTONE)
Sep 8 11:00:50 islay chat[17106]: abort on (NO DIAL TONE)
Sep 8 11:00:50 islay chat[17106]: abort on (NO ANSWER)
Sep 8 11:00:50 islay chat[17106]: send (ATZ^M)
Sep 8 11:00:50 islay chat[17106]: expect (OK)
Sep 8 11:00:50 islay chat[17106]: ATZ^M^M
Sep 8 11:00:50 islay chat[17106]: OK
Sep 8 11:00:50 islay chat[17106]: -- got it
Sep 8 11:00:50 islay chat[17106]: send (ATDT0860888080^M)
Sep 8 11:00:50 islay chat[17106]: expect (CONNECT)
Sep 8 11:00:50 islay chat[17106]: ^M
Sep 8 11:01:16 islay chat[17106]: ATDT0860888080^M^M
Sep 8 11:01:16 islay chat[17106]: CONNECT
Sep 8 11:01:16 islay chat[17106]: -- got it
Sep 8 11:01:16 islay chat[17106]: send (^M)
Sep 8 11:01:16 islay chat[17106]: expect (Login:)
Sep 8 11:01:16 islay chat[17106]: 48000^M
^^^^^^^^^^^^^
Sep 8 11:01:21 islay chat[17106]: ^M
Sep 8 11:01:21 islay chat[17106]: Login:
Sep 8 11:01:21 islay chat[17106]: -- got it
Sep 8 11:01:21 islay chat[17106]: send (fti/9x67ktd^M)
Sep 8 11:01:21 islay chat[17106]: expect (Password:)
Sep 8 11:01:22 islay chat[17106]: fti/9x67ktd^M
Sep 8 11:01:22 islay chat[17106]: Password:
Sep 8 11:01:22 islay chat[17106]: -- got it
Sep 8 11:01:22 islay chat[17106]: send (??????)
Sep 8 11:01:22 islay chat[17106]: send (\d)
Sep 8 11:01:23 islay pppd[17104]: Serial connection established.
Sep 8 11:01:23 islay pppd[17104]: using channel 10
Sep 8 11:01:23 islay pppd[17104]: Using interface ppp0
Sep 8 11:01:23 islay pppd[17104]: Connect: ppp0 <--> /dev/ttyS0
Sep 8 11:01:24 islay pppd[17104]: local IP address 193.250.90.34
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^6
Sep 8 11:01:24 islay pppd[17104]: remote IP address 193.252.253.35
Sep 8 11:01:24 islay pppd[17104]: primary DNS address 193.252.19.3
Sep 8 11:01:24 islay pppd[17104]: secondary DNS address 193.252.19.4
Sep 8 11:01:24 islay pppd[17104]: Script /etc/ppp/ip-up started (pid
17108)
Sep 8 11:01:24 islay pppd[17104]: rcvd [CCP ConfRej id=0x2]
Sep 8 11:01:25 islay fetchmail[17127]: starting fetchmail 5.8.3 daemon
......
Sep 8 11:02:58 islay pppd[17104]: Terminating on signal 15.
Sep 8 11:02:58 islay pppd[17104]: Script /etc/ppp/ip-down started (pid
17152)
Sep 8 11:02:58 islay pppd[17104]: sent [LCP TermReq id=0x2 "User
request"]
Sep 8 11:02:58 islay pppd[17104]: rcvd [LCP TermAck id=0x2]
Sep 8 11:02:58 islay pppd[17104]: Connection terminated.
Sep 8 11:02:58 islay pppd[17104]: Connect time 1.6 minutes.
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sep 8 11:02:58 islay pppd[17104]: Sent 9224 bytes, received 18950
bytes.
Sep 8 11:02:58 islay pppd[17104]: Hangup (SIGHUP)
Sep 8 11:02:58 islay pppd[17104]: Waiting for 1 child processes...
Sep 8 11:02:58 islay pppd[17104]: script /etc/ppp/ip-down, pid 17152
Connection time (in Shell+French)
#!/bin/sh
mois=`date |awk '{print $2}'`
#echo $mois
i=0
for j in `zgrep $mois /var/log/syslog* | grep -e "Connect time" |awk
'{print $8}'`;
do
i=`echo "$j+$i"|bc -l`
done
k=`echo $i'/60'|bc`
l=`echo $i'-60*'$k |bc`
echo Temps de connection total au mois de $mois : $k heures et $l
minutes.
Bye
--
Jérôme
.-. .-.
/v\ B i - T U X /v\
// \\ // \\
/( )\ P O W E R E D /( )\
^^-^^ ^^-^^
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!