Re: rc script to let a service wait for db available
- In reply to: Eugene Grosbein : "Re: rc script to let a service wait for db available"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 21 May 2022 11:58:27 UTC
Changing this to: - - - meteoavg_start() { /usr/local/bin/wait_for_pgsql.sh ${meteoavg_wfphost} ${meteoavg_wfpuser} ${meteoavg_wfpdb} "/usr/local/bin/${name} ${meteoavg_flags}" & } - - - does not solve the issue. On system boot this script still blocks rc and prevents any other services from being started, including the the jail with the pgsql server, where wait_for_pgsql.sh tries to connect. > Am 27.04.2022 um 16:37 schrieb Eugene Grosbein <eugen@grosbein.net>: > > 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. > Axel --- PGP-Key: CDE74120 ☀ computing @ chaos claudius