I have a simple script at /etc/network/if-up.d/test containing the following line

date >> /var/log/testing.log

Running that script manually works fine. However, rebooting the system runs it twice. And disconnecting/reconnecting the ethernet cable does not run it at all. How can I make it work in all 3 scenarios?


It is being run twice at startup because it is running for both the loopback (lo) and ethernet interface(eth0).

Try this in your script. It should show the interface name.

echo $IFACE  >> /var/log/testing.log

The man page for ifup has this note:

Note that the program does not run automatically: ifup alone does not bring up interfaces that appear as a result of hardware being installed ...

According to the same man page ifplugd may be an option.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.