Run Script on Interface Status Change (to re-enable 3g usb modem)



  • Hello I have a Huawei E367 3G Dongle and it regularly drops out (showing a red X in the Interfaces box in the dashboard) unplugging it and plugging it back in fixes it.

    But I did just learn how to power the 3G dongle off and then on with usbconfig -u 4 -a 2 power_off and usbconfig -u 4 -a 2 power_on which gets this connection up and working again!

    What I'd like to do is to automate this usbconfig command with a script, that will run when this interface goes down to get it working again, I'm not familiar with freebsd and so would really appreciate some help.

    Thanks.


  • Rebel Alliance Developer Netgate

    There's no quick/easy way to trigger that without explaining a lot (either devd or scripting it in PHP) – you could probably drop some commands in /etc/rc.newwanip to make that happen but you'd need to be sure it only happens when that is triggered by the 3g interface



  • @jimp:

    There's no quick/easy way to trigger that without explaining a lot (either devd or scripting it in PHP) – you could probably drop some commands in /etc/rc.newwanip to make that happen but you'd need to be sure it only happens when that is triggered by the 3g interface

    Hi Jimp, I appreciate the response. What is devd? Have you seen a script written for this purpose that I could adapt or get adapted?

    …Thanks...



  • @jimp:

    There's no quick/easy way to trigger that without explaining a lot (either devd or scripting it in PHP) – you could probably drop some commands in /etc/rc.newwanip to make that happen but you'd need to be sure it only happens when that is triggered by the 3g interface

    If I was to use Embedded (NanoBSD) could I still use devd or scripting it in PHP?


  • Rebel Alliance Developer Netgate

    Yes, the same mechanisms work on NanoBSD and a full install, the only difference is that if you edit files on the NanoBSD filesystem you have to flip it to Read/Write mode first.


Log in to reply