Page 1 of 1

Trigger script with ethernet cable

Posted: Wed Jun 04, 2014 12:52 pm
by Adrinosaure
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! :)

Re: Trigger script with ethernet cable

Posted: Wed Jun 04, 2014 1:57 pm
by DeeJay
ssh?

Re: Trigger script with ethernet cable

Posted: Wed Jun 04, 2014 6:33 pm
by asandford
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

Re: Trigger script with ethernet cable

Posted: Wed Jun 04, 2014 7:17 pm
by Adrinosaure
Thanks a lot !