OpenWrt Forum Archive

Topic: init script dependencies

The content of this topic has been archived on 31 Mar 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

hello ,
Is there any option to set up a depending service , that mast be runing before another is started ?

my setup is little specific here , I have radiusd with postgresql backend starting on wrt160nl , postgres has START=50 option  radius get from me a 94  , still in some cases postgres did not finish full start to accept radiusd connection (little explanation here : postgres start by executing postmaster command ,after that exit with ok status , create a pid file (that making my idea of pid file check before radiusd start unusable) then it take some time to start postgres server. Here is full process list of full state (
/mnt/sda2/usr/bin/postmaster -D /data
postgres: writer process                       
postgres: wal writer process                   
postgres: autovacuum launcher process         
postgres: stats collector process )
)
so I put "sleep 7" before radius execution in his init script  , but its very dirty  ...and not reliable
is here any ability of openwrt init script , or any other option to start radiusd only if postgres running ?

Hi.

No, OpenWrt has no concept of init script dependencies apart from the ordering using the START and STOP variables.
Can't you just change the postgres startup script to block until the server is ready to handle connection, e.g. by doing a wait-poll-loop?

~ JoW

I don't know how ,init scrit only execute postmaster -D $DATASTORE  ,next steps are on postmaster process. Init scripts end by doing that. I hope the check in radiusd init script will be better.
My next idea is handle output from ps by sed , and check if there are four postgres services , or just try to connect to postgres listening port , if it fail , wait one second and do it again. After success start radiusd  ...sed is not my friend for now ,so man can be wink
update : im fool , whi sed - grep can handle that smile

(Last edited by calltrace on 18 Jan 2010, 14:28)

The discussion might have continued from here.