Automatic shutdown on network disconnection

Hello,

I’m trying to have MBL automatically switched off after network disconnection.

I’m looking for a SW trigger linked to network disconnection event, that calls a sh script like ‘halt’.

I wish to avoid polling solution (cron sh with router ping every X seconds, that, when failed, exceutes ‘halt’).

I found this simple script:

http://www.techytalk.info/start-script-on-network-manager-successful-connection/

but it needs NetworkManager to work, could it be a good idea to install it on MBL?

Thank you!

This should be possible but you would have to track down the script that is run when a network disconnection is detected.

Are you saying that you will be physically unplugging the cable or is there some other way your disconnecting the MBL from the network?

Hi,

I mean to detect when the network switch where the MBL is physically connected is shut down, so the MBL network goes down.

I wish to catch the same event that makes the led blinking yellow (no network link), to have the MBL switched off.

Thank you!

I managed to obtain what I want, simply by adding this line in /etc/network/interfaces:

post-down halt

This means that when the network interfaces goes down, the MBL is switched off! :smiley:

1 Like

Nice, thanks for coming back and sharing your solution :slight_smile: