From owner-freebsd-ports@FreeBSD.ORG Thu May 10 19:19:04 2007 Return-Path: X-Original-To: freebsd-ports@freebsd.org Delivered-To: freebsd-ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 98CB216A403 for ; Thu, 10 May 2007 19:19:04 +0000 (UTC) (envelope-from fbsd06@mlists.homeunix.com) Received: from mxout-03.mxes.net (mxout-03.mxes.net [216.86.168.178]) by mx1.freebsd.org (Postfix) with ESMTP id 6FCC513C45D for ; Thu, 10 May 2007 19:19:04 +0000 (UTC) (envelope-from fbsd06@mlists.homeunix.com) Received: from gumby.homeunix.com. (unknown [87.81.140.128]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.mxes.net (Postfix) with ESMTP id B87C05193F for ; Thu, 10 May 2007 15:18:59 -0400 (EDT) Date: Thu, 10 May 2007 20:18:46 +0100 From: RW To: freebsd-ports@freebsd.org Message-ID: <20070510201846.76992f5b@gumby.homeunix.com.> In-Reply-To: <1178788588.4642e2ec084e2@imp.free.fr> References: <1178788588.4642e2ec084e2@imp.free.fr> X-Mailer: Claws Mail 2.9.1 (GTK+ 2.10.12; i386-portbld-freebsd6.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: Startup script's race condition with zabbix over MySQL X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 May 2007 19:19:04 -0000 On Thu, 10 May 2007 11:16:28 +0200 l.cligny@free.fr wrote: > > Hello, > > I've set up a FreeBSD 6.2-RELEASE Box to act as a zabbix server. > > The relevant packages I use are: > > zabbix-1.1.7,1 > mysql-server-5.0.37 > > Fisrt of all, both software works properly, my setup run well if I > run them manually via /usr/local/etc/rc.d. No error messages. > > But I had a problem when I put the MySQL and zabbix_server services > to run in /etc/rc.conf, in order to start them at startup. They belong in /usr/local/etc/rc.d > In fact the MySQL start first, and then the zabbix-server follows > immediately, which makes sense, (I made it sure by adding "# REQUIRE > mysql", without quotes, to the head > of /usr/local/etc/rc.d/zabbix-server script). So the logic startup > order is respected. > > But, at every boot, my zabbix-server daemon won't start, the zabbix's > log file saying "could not connect to socket "/tmp/mysql.sock"". So I > put a dirty "sleep 10" in /usr/local/etc/rc.d/zabbix_server script, > just after variables declarations, and now it works well at each > startup. > > Does some of you guys have a better method to fix this race-condition > behavior (maybe a "file exists" condition over the /tmp/mysql.sock > file or so), in the zabbix_server FreeBSD startup script ? I would suggest you you write a new script that's ordered between the two, and waits for the socket. That avoids having to maintain any modifications to port installed scripts.