Re: Delay startup of services in rc.conf || elswhere

2008-11-18 Thread Valentin Bud
Hello bsd,

 I once had a problem just like yours. I introduced at the end
of the mysql startup script from /usr/local/etc/rc.d a sleep 10 command
and that did the trick.

all the best,
v

On Tue, Nov 18, 2008 at 1:05 PM, bsd [EMAIL PROTECTED] wrote:
 Hello,


 I have a server configured to start 10 services at startup (in /etc/rc.conf)

 Unfortunately, the startup of MySQL seems to be returning ok before It
 actually has started completely the program… the next program rely on MySQL
 and does not start well because the database is not fully started.

 I would like to introduce something like a sleep 10 timer in the service
 startup process…


 How can I do that?


 
 Gregober --- PGP ID -- 0x1BA3C2FD
 bsd @at@ todoo.biz
 

 P Please consider your environmental responsibility before printing this
 e-mail


 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to [EMAIL PROTECTED]

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Delay startup of services in rc.conf || elswhere

2008-11-18 Thread Mel
On Tuesday 18 November 2008 12:05:33 bsd wrote:
 Hello,


 I have a server configured to start 10 services at startup (in /etc/
 rc.conf)

 Unfortunately, the startup of MySQL seems to be returning ok before
 It actually has started completely the program… the next program rely
 on MySQL and does not start well because the database is not fully
 started.

 I would like to introduce something like a sleep 10 timer in the
 service startup process…


 How can I do that?

There's no standard support for this. You will have to modify the script in 
(/usr/local)/etc/rc.d/ for that service, specifically the ${name}_start 
function. You will however have to do this with each update, so it is 
generally better to contact the author of the service that depends on MySQL, 
to more gracefully start up: if the connection can't be made that it tries 
again until it does (maybe with a max_retries setting). This is very trivial 
stuff in daemons.

-- 
Mel

Problem with today's modular software: they start with the modules
and never get to the software part.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Delay startup of services in rc.conf || elswhere

2008-11-18 Thread RW
On Tue, 18 Nov 2008 12:05:33 +0100
bsd [EMAIL PROTECTED] wrote:

 Hello,
 
 
 I have a server configured to start 10 services at startup (in /etc/ 
 rc.conf)
 
 Unfortunately, the startup of MySQL seems to be returning ok
 before It actually has started completely the program___ the next
 program rely on MySQL and does not start well because the database is
 not fully started.
 
 I would like to introduce something like a sleep 10 timer in the  
 service startup process___

The cleanest solution is to create a minimal rc script that will sort
between the mysql and the affected services, and just give it a start
command that pauses for 10 seconds. 

I do a similar thing where I poll for network access before allowing
anything that relies on it to start.



#!/bin/sh
#
# PROVIDE: networkwait
# REQUIRE: named
# BEFORE:  ntpdate

. /etc/rc.subr

networkwait_enable=${networkwait_enable:-NO}
name=networkwait
rcvar=`set_rcvar`
stop_cmd=:
start_cmd=networkwait_start   


networkwait_start(){
   if [ $networkwait_ping_hosts ] ; then
  host_list=${networkwait_ping_hosts}
   else
  # No hosts supplied - use external nameservers
  host_list=`awk '/^ *nameserver/ {print $2}
' /etc/resolv.conf | grep -E -v '^127\.0+\.0+\.0*1'`
   fi
   echo -n Waiting for network access ... 
   while true ; do
  for inet_host in $host_list ; do
 if ping -nc1  $inet_host 21  /dev/null ; then
echo ping to ${inet_host} succeeded.
# Re-Sync ipfilter and pf in case
# they had failed DNS lookups
/etc/rc.d/ipfilter resync
/etc/rc.d/pf resync
exit 0
 fi
  done
  sleep 5
   done
}

load_rc_config ${name}
run_rc_command $1
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]