Re: rc script to let a service wait for db available
Date: Wed, 27 Apr 2022 14:37:19 UTC
27.04.2022 21:30, Axel Rau wrote: > Hi all, > > I have this rc script: > - - - > meteoavg_wfphost="dbb3" > meteoavg_wfpuser="meteo" > meteoavg_wfpdb="operations" > # > # > > . /etc/rc.subr > > name="meteoavg" > rcvar=${name}_enable > command=/usr/local/bin/meteoavg > > load_rc_config $name > > : ${meteoavg_enable="NO"} > : ${meteoavg_flags=" -l syslog:daemon -s Chaos1"} > > : ${meteoavg_pidfile="/var/run/meteoavg-Chaos1.pid"} > > pidfile="${meteoavg_pidfile}" > > ##start_cmd="${name}_start" > stop_precmd="${name}_prestop" > > meteoavg_start() { > /usr/local/bin/wait_for_pgsql.sh ${meteoavg_wfphost} \ > ${meteoavg_wfpuser} ${meteoavg_wfpdb} \ > "/usr/local/bin/${name} ${meteoavg_flags} &" > } > - - - > The rc ignores the '&' and waits for wait_for_pgsql.sh to complete. > > How can I let rc continue without waiting? You need to place '&' outside of double-quotes. But better use daemon(8) command instead of '&' because daemon does better job ignoring signals etc. and that may be important if wait time extends past point when system goes to multiuser mode.