Just for the sake of showing what we do, here's our setup for MySQL at all our sites.

We use Dan Bernstein's daemontools package to monitor all our services, MySQL included. You can download and install them easily from http://cr.yp.to/daemontools.html. They won't touch your system files except by adding a line (by default) to your /etc/inittab to start svscan, the service starter.

Having this installed and working, we create a /var/mysql/service directory and /var/mysql/service/log.

/var/mysql/service/log/run is an executable file containing one line to log all output with nanosecond timestamps to a file: "exec setuidgid logging multilog t /var/log/mysql/"

/var/mysql/service/run contains a shell script to start mysqld:

#!/bin/sh

sleep 2 # To make `mysqladmin shutdown` work properly

exec 2>&1
exec envdir ./env /usr/bin/safe_mysqld \
--log-slow-queries=/var/log/mysql/slow_queries \
--log-bin=/var/log/mysql/transactions \
--log=/var/log/mysql/queries
{eof}

We're using `envdir` to empty and initialize the environment so /var/mysql/service/env contains one file for each environment variable to be set, including PATH, TMPDIR, TZ, UMASK and UMASK_DIR.

After the directories are all set up and the `run` files are executable, simply:
$ cd /service
$ ln -s /var/mysql/service mysqld
... and the MySQL service will start up, monitored by supervise and restarted automatically if killed (after the two second sleep in the run file). The sleep is there to stop respawns from being too fast and to keep from confusing mysqladmin; when you do mysqladmin shutdown, it gets confused if mysqld starts back up too soon (thinking it didn't shut down yet I suppose).

Just FYI ... :-)

--
Michael T. Babcock
C.T.O., FibreSpeed Ltd. (sql)
http://www.fibrespeed.net/~mbabcock



---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to