Sequential exec of init scripts guaranteed?


Is it guaranteed, that script serviceA is completed, before serviceB is started ?
If yes, there might be a case, in which the real action of serviceA is initiated via netifd or procd, using a ubus-call. I.e. /etc/init.d/network seems to do this. May this cause async activities, causing scriptB to complete before scriptA ?

1 Like

Execution of the init script shell code is guaranteed to be sequential, service startup is handed to procd though and happens asynchronously and concurrently

Which means, the sequence of execution is non-deterministic. Not a very good concept, IMHO. On my RUT955, it is required to select the SIM to be used for wwan by GPIO (/etc/init.d/gpio_switch). Which, obviously, should happen before the wwan is started in /etc/init.d/network . However, I see S94gpio_switch and S20network in etc/rc.d in the standard image, built from source. Which definitely is a bug, I think. It should be guaranteed, that the GPIO is set before network is started, assuming, this will also (re-)start the modem. Which I am not so shure about, but that is another story.

in my humble opinion (and I can surely be wrong, i'm not a good developer)

whether /etc/rc.d/S20serviceB depends on success of /etc/rc.d/S19serviceA or merge scripts

or make /etc/rc.d/S19serviceA write a temporary file if its output is correct and to /etc/rc.d/S20serviceB
it checks if the temporary file exists and then it proceeds with its execution

thanks to all the developers and also to

for your activity in this forum