UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor
Contributor
109 Views
Registered: ‎07-17-2018

How do I set eth0 link up script?

Hi All!


I want to execute script when eth0 links up.

I added my script file at /etc/network/if-up.d/.

And I pluged and unpluged lan cable.

But my script was not executed.

What is wrong?

Thank you!
0 Kudos
2 Replies
Scholar watari
Scholar
95 Views
Registered: ‎06-16-2013

Re: How do I set eth0 link up script?

Hi @jrceokura 

 

Here is solution for you.

 

$ inotifywait -e modify /sys/class/net/eth0/carrier; echo "Change detected !"

 

[note]

"inotify" API can monitor an event of file system on Linux.

 

In this case, you can detect change to use "inotifywait" with "-e modify" option.

 

Best regards,

Contributor
Contributor
56 Views
Registered: ‎07-17-2018

Re: How do I set eth0 link up script?

Hi watari!

Thank you for your reply.

I tried your idea.

But I can't see "Change detected !".

In addition When I did $cat /sys/class/net/eth0/carrier, I can see message "/sys/class/net/eth0/carrier OPEN."

I think that when driver modifys /sys/class/net/eth0/carrier, inotifywait can't notice modifing.

Thank you!

 

 

0 Kudos