Startup script's race condition with zabbix over MySQL

RW fbsd06 at mlists.homeunix.com
Thu May 10 19:19:04 UTC 2007


On Thu, 10 May 2007 11:16:28 +0200
l.cligny at 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.


More information about the freebsd-ports mailing list