Hi,
sorry for the late reply, I was very busy (moving to Berkeley from
Munich etc.). The following is the wrapper script I use for controlling
mysql from my init system.

-----
#!/bin/sh
cd /
umask 077

MYSQLADMIN='/usr/bin/mysqladmin
--defaults-extra-file=/etc/mysql/debian.cnf'

trap "$MYSQLADMIN shutdown" 0
trap 'exit 2' 1 2 3 15

/usr/bin/mysqld_safe & wait
-----

As you can see, I'm just running a shell script which launches mysql and
waits for it to finish; if the wrapper recieves a SIGTERM it will just
exit; upon exit it will trigger a shutdown in mysql.
Maybe the case when mysql has exited from itself should be treated
differently, but this way it is assured that even when the wrapper dies,
a running mysql process will be shut down. For example, when mysql was
already running, this will try to start a new one, and if this fails
shutdown the other instance (and my init will then respawn this, and
obtain a managed mysql that way)

Greetings,
Erich Schubert
-- 
   erich@(vitavonni.de|debian.org)    --    GPG Key ID: 4B3A135C    (o_
    Go away or i'll replace you with a very small shell script.     //\
   Jede Frau erwartet von einem Mann, dass er hält, was sie sich    V_/_
                         von ihm verspricht.


Reply via email to