Cnetworkmanager - restart network connection - script integration advice



Hi all,

I have a box acting as a gateway/web server which uses HSPA for backhaul. I use the network manager applet (0.7.0.100) for management, but often I have to admin the box remotely and so I've started using cnetworkmanager. Occasionally, my connection to the Internet will completely die or start dropping a large percentage of externally bound packets. I normally find reconnecting my cellular connection fixes most issues, and so I'm confident that any glitches are at the mast side.

I want to put into place a basic script scheduled say, every 15mins with cron, that will ping a few reliable IPs and if the machine is dropping a large amount of traffic, will automatically reconnect my connection by restarting networking services, issuing sudo cnetworkmanager --acti "system,Cellular,ttyHS1,", and finally restarting squid.

My problem is that when I issue my cnetworkmanager command, although it dutifully cycles my connection, it doesn't actually exit its loop and give me back my command line. I have to hit Ctrl + C to break the loop.

(17:55:36) State: CONNECTING
(17:55:43) State: CONNECTED
^CLoop exited
richard richard-u:~$

I'm not great at bash scripting and a couple of guys at the Ubuntu forums have been help in putting together the script itself. As you can probably guess my problem is that I don't know how to get the script to emulate the SIGINT signal and continue with the next part of the script. Also, I wanted to bring this up because I'm not sure if there's another way of going about this problem, or even if this is how cnetworkmanager should act.

Kind Regards,

Richard Braddock


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]