Run script after all interfaces are up

Hi! I have a program that has to be executed after all interface gets up. I wrote shell script that excutes my program in /etc/rc.local but it didn't worked well. Is there any way to run my script after all interface gets up?

Edit: Before I give any advice, maybe describe a little bit more in detail what exactly you are trying to achieve? Does that script have to execute once or every time all interfaces go up?

1 Like

Nope. My script has to be excute just once after boot. Before that my openwrt fails to boot after I edited /etc/rc.local is there any way to fix it?

A description of what your script is doing is important.

Also, how go you define “up”?

Do you have any tunnels, VPNs, client links, meshes, cellular connectivity, or the like?

Any other features of your network that aren’t wired Ethernet connections?

2 Likes

If I remember correctly, the boot process waits until "rc.local" ends, is your program returning when called from "rc.local'?

You can place a script at "/etc/hotplug.d" and it will be executed every time an interface changes, but you will have to check out by yourself when is the proper time to launch your program.

1 Like

KISS: In /etc/rc.local insert one line
/etc/waitforinterfacesup.sh &

In /etc/waitforinterfacesup.sh , in a loop check the interfaces.

Thanks! Your reply inspired me to easily implement a DDNS service just by putting a script in /etc/hotplug.d/iface/99-ddns, which will run automatically every time after the PPPoE dial-up connection is performed.

Is there anything wrong with the current implementation of DDNS in OpenWrt?

1 Like