I want to run a bash or python script once when the ethernet cable is plugged in or out.

I am using CentOs 6.8;

  • I write a script and save as "ifup-pre-local" into "/sbin", it works only when I restart the network service. When I unplug/plug the cable, there is nothing.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.