Adrinosaure
Posts: 6
Joined: Thu Apr 10, 2014 6:39 am

Trigger script with ethernet cable

Wed Jun 04, 2014 12:52 pm

Hi everyone, everything is in the title. I don't know if its possible but I would like to see my bash script running when I plug in an ethernet cable. Thanks for you answer! :)

User avatar
DeeJay
Posts: 2027
Joined: Tue Jan 01, 2013 9:33 pm
Location: East Midlands, UK

Re: Trigger script with ethernet cable

Wed Jun 04, 2014 1:57 pm

ssh?
How To Ask Questions The Smart Way: http://www.catb.org/~esr/faqs/smart-questions.html
How to Report Bugs Effectively: http://www.chiark.greenend.org.uk/~sgtatham/bugs.html

asandford
Posts: 1996
Joined: Mon Dec 31, 2012 12:54 pm
Location: Waterlooville

Re: Trigger script with ethernet cable

Wed Jun 04, 2014 6:33 pm

The ifplugd daemon can do this, have a read here

Especially this bit
/etc/ifplugd/ifplugd.action: this is the script which will be called by the daemon whenever the state of the interface changes. It takes two areguments: the first is the interface name (eg. eth0), the second either "up" or "down".
This daemon is (probably) already running on you pi

Adrinosaure
Posts: 6
Joined: Thu Apr 10, 2014 6:39 am

Re: Trigger script with ethernet cable

Wed Jun 04, 2014 7:17 pm

Thanks a lot !

Return to “Interfacing (DSI, CSI, I2C, etc.)”