wvdial (PPP dialer) with a SIM card modem and sometimes this connection is reset by server side. I would like to run a script which greps
ifconfig to get a volume of data downloaded and stores it somewhere. Obviously it has to be done when connection is still alive, otherwise I get nothing, or a few seconds later a value for fresh connection, because
wvdial is configured to immediately reconnect when connection is lost. Any idea?
Of course I can grep output of
ifconfig every second or two, but this is horrible workaround not even worth considering. The best scenario I can imagine is to somehow capture the signal which instructs
ifconfig to "reset the counting" => suspend signal for a moment => run my script => unlock the signal. But maybe there are other possibilities which I'm not aware of like for example configure
ifconfig itself to dump the previous result to a file if given interface disappears. Another option is to take output not from
ifconfig by elsewhere. BTW, what is the input source for