On Wed, Aug 29, 2012 at 1:49 AM, Patrick Dupre <pdupre(a)kegtux.org> wrote:
On 2012-08-28 20:19, Mikkel L. Ellertson wrote:
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 08/28/2012 10:49 AM, Kevin Martin wrote:
>>
>> On 08/28/2012 09:13 AM, Patrick Dupre wrote:
>>>
>>> On 2012-08-28 16:04, Marko Vojinovic wrote:
>>>>
>>>> On Tuesday, 28. August 2012. 12.15.16 Patrick Dupre wrote:
>>>>>
>>>>> The NetworkNamager provides a disconnect option. I undertand
>
> that it
>>>>>
>>>>> can be manager through /etc/NetworkManager/dispatcher.d
>>>>> However, when I disconnect the ppp0 connection, ppp0 is already
>>>>> down (due to the disconnect) and prevents me to collect information
>>>>> through ifconfig.
>>>>>
>>>>> How can I avoid this problem. I wish to collect information of the
>>>>> ppp0 just before it is turned off.
>>>>
>>>>
>>>> Wasn't this covered in another thread already?
>>>>
>>>> If you want to see ifconfig output just before disconnecting, open a
>>>> terminal,
>>>> type "ifconfig", read the output, then disconnect. It's
pretty
>
> obvious, I
>>>>
>>>> guess.
>>>>
>>>> So, the nonobvious thing is: what precisely is the actual
>
> problem you are
>>>>
>>>> trying to solve? Please try to be more precise.
>>>>
>>> I want it does it automatically!
>>>
>>
>> The problem I see in what you are trying to do is that there is no
>
> way to determine when exactly a disconnect will be taking place.
>>
>> If you know exactly when a disconnect will take place then it
>
> should be fairly simple to script it but if the disconnects take
>>
>> place randomly there is no way you'll be able to script it. You
>
> would have to have a program (daemon) running with hooks into the
>>
>> network stack that reported statistics at the time of the
>
> disconnect and I don't think that's easy to do and certainly would
> require
>>
>> an in depth knowledge of programming at the driver level to do it.
>>
>> Kevin
>>
> One thing you could try is creating a /sbin/ifdown-pre-local script.
> You will have to do a compare of $1 with ppp0, and exit if it is a
> different interface, because it is run before bringing any interface
> down. I am not sure if Network Manager uses the ifdown script, but
> you could alway run ifdown ppp0 to disconnect. This will not help if
> the interface goes down without you telling it to.
>
I tried, but /sbin/ifdown-pre-local is never activated
ifdown ppp0 gives: usage: ifdown <device name>
ppp0 is not recognized as a device!
I also tried to use /etc/NetworkManager/dispatcher.d/20-ifdown
but it is also never activated.
I though that /etc/sysconfig/network-scripts/ifdown-ppp
could do the job, but again it is never activate when I disconnect the
network.
This is the result of ifconfig ppp0
ppp0 Link encap:Point-to-Point Protocol
inet addr:111.169.43.118 P-t-P:10.64.64.64 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:1370 errors:0 dropped:0 overruns:0 frame:0
TX packets:1381 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:1741245 (1.6 MiB) TX bytes:94465 (92.2 KiB)
Other ideas?
Try to create /etc/ppp/ip-down.local script. I'm not sure if it will
be activated by NM, but worth trying.