Startup script's race condition with zabbix over MySQL

l.cligny at free.fr l.cligny at free.fr
Thu May 10 09:41:27 UTC 2007


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.

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 ?

Another issue I found is when zabbix exits after claiming /tmp/mysql.sock
doesn't exists, it leave its PID file on /var/tmp/zabbix_server.pid, which avoid
also starting zabbix_server, even manually by rc.d script, if we don't remove it
 before.

P.S: sorry for my "English"

Cheers,

Laurent CLIGNY






More information about the freebsd-ports mailing list