Quote:
Originally Posted by number-g
i'm with a 3g isp with a limited monthly bandwidth allowance and high overage fees;
|
This probably doesn't help, but I note that 3 currently have an offer with a 15G/£15 monthly deal.
BTW, I'm assuming that you are using one of the, eg Huawei, USB dongles and that you don't have the companion router box.
Quote:
there is no facility to measure how much i've used in any given month
|
3 don't have a web page or something where you van look that up; that's an incredible oversight...no, sorry, knowing how inept some of these people are that really ought to be 'should be an incredible oversight'
Quote:
so i want the script to run every time the interface goes down so that i can keep an eye on my bandwidth use.
my script just runs "ifconfig ppp0" and reads the last line, then takes the relevant information for processing elsewhere.
the problem (i think) i have ran into is that when i ctrl-c wvdial (or reboot the system or whatever), ppp0 is down before the script can run ifconfig to check the RX/TX, so it doesn't work.
|
Well, I think your diagnosis of the problem is correct (and inevitable). If you stop the program with a control C, then it won't do the normal clean up at the end, and that includes writing out whatever information it would normally do to the command line. I'm not sure what the answer is, but there are a few options you can try:
- don't use ^C to stop wvdial
- if you don't use '-no-syslog', some information should get written to syslog, so it might be worth having a look to see if anything useful get written there
- use the router box (this isn't so much a solution, as a way of moving the problem somewhere else...but if that data goes over ethernet, you can use iptables to count packets (is there an option for bytes??) or maybe the router box itself can count the data)
If you don't use ^C, you have to stop wvdial somehow, and the issue is can you send it a signal that stops it, but does allow it to write out data as its final act? You could try something like SIGTERM instead of SIGINT (effectively) and see what happens.