Gerrit Pape | 2 Sep 2003 14:33

Re: Runit scripts and mysql

On Tue, Sep 02, 2003 at 02:12:29PM +0200, Erich Schubert wrote:
> > Yes.  I don't use mysql, but from what I've read, it doesn't terminate
> > when receiving a TERM signal on Linux.  If mysql would do that, there
> > would be no problem.
> 
> Attached is a script i hacked together which works for me.
> It's kind of debian-specific, because it relies on the distribution admin
> uesr with shutdown rights in mysql. Users of other distributions will
> need to modify the MYSQLADMIN line.
> 
> ----- mysql/run -----
> #!/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
> -----

> I tried without the "& wait", but it didn't recieve the signals then.
> It's an ugly hack, but it works. (tm)

Thanks, I'll add this to the collection of run scripts on the runit web
page.

>                                          But i will open a bug report
> against mysql-server today -- it really should support shutdown via
> -TERM...

Great, hopefully they will understand the need for that, and support it
in future version.

> Here is also a modified script for rpc.mountd:
> the difference to the one from the collection on the web page is that
> this script will kill all nfsd when stopped, not only mountd.
> ("killall -2 nfsd" seems to be the proper way to shutdown these - the
> debian standard script uses start-stop-daemon  "--signal 2")

Thanks again, I'll adapt the script on the web page.

Regards, Gerrit.


Gmane