List:General Discussion« Previous MessageNext Message »
From:Thimble Smith Date:July 29 1999 9:58pm
Subject:Re: You should mention /etc/rc0.d/S01mysql in the docs
View as plain text  
At 13:25, 19990729, Robin Bowes wrote:
>Sasha Pachev wrote:
>> 
>> Actually, myslqd will shut itself down exactly the same way on SIGTERM,
>> although having a link in /etc/rc.d/rc0.d would not hurt.
>> 
>
>There is a potential problem here, under FreeBSD at least.  Basically,
>the "shutdown" command doesn't send a SIGTERM to all processes; it
>basically just brings the system down.  This caused me all sorts of
>problems, not least with squid, until I got to the bottom of it.

That is not the case, at least with recent versions of FreeBSD.  I
am using FreeBSD 3.2-STABLE and MySQL 3.22.19.  When I issue a
shutdown command (-r, -h or plain shutdown), mysqld receives a
TERM signal and quits normally, as shown in the `hostname`.err
file:

990729 14:49:12  /usr/local/mysql/libexec/mysqld: Normal shutdown

990729 14:49:12  /usr/local/mysql/libexec/mysqld: Shutdown Complete

mysqld ended on  Thu Jul 29 14:49:12 MST 1999

Your shutdown alias (kill -INT 1) is identical to 'shutdown -r now'.
Using INT instead of TERM only makes init(8) reboot instead of halt
the machine.  But init still takes care of sending a TERM signal to
every process and waiting up to 30 seconds for them to finish their
business before killing them for good.

FreeBSD users should not need any special measures in order for
mysqld to shut down properly.

/etc/rc.shutdown will be called when 'shutdown' is used, normally.
It doesn't matter if you use 'shutdown -r' or '-h' or '-p'.  If you
find that it doesn't work like that for you, it's a bug in FreeBSD
and probably upgrading your version will solve it.

Tim

>My solution is to send a SIGINT to the init process to shutdown my
>machines.  I have an alias defined:
>
>alias shutdown='kill -INT 1'
>
>This causes /etc/rc.shutdown to be executed.  I have modified rc.??? to
>give the following rc.shutdown script:
>
>#!/bin/sh
>#  $Id: rc.shutdown,v 1.1 1997/08/02 00:22:45 davidn Exp $
>
># site-specific closing actions for daemons run by init on shutdown
># or before going single-user from multi-user.
># Output and errors are directed to console by init, and the
># console is the controlling terminal.
>
>stty status '^T'
>
># Set shell to ignore SIGINT (2), but not children;
># shell catches SIGQUIT (3) and returns to single user after fsck.
>trap : 2
>trap : 3 # shouldn't be needed
>
>HOME=/; export HOME
>PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin
>export PATH
>
>echo -n Shutting down daemon processes:
>
># Insert shutdown procedures here
>
># pull in rc.conf to set $local_startup
>if [ -f /etc/defaults/rc.conf ]; then
>   . /etc/defaults/rc.conf
>elif [ -f /etc/rc.conf ]; then
>   . /etc/rc.conf
>fi
>
># for each valid dir in $local_startup, search for init scripts matching
>*.sh
>        echo -n 'Local package shutdown:'
>        for dir in ${local_startup}; do
>                [ -d ${dir} ] && for script in ${dir}/*.sh; do
>                        [ -x ${script} ] && \
>                                (trap 'exit 1' 2 ; ${script} stop ; echo
>-n)
>                done
>        done
>echo '.'
>exit 0
>
>
>I have also modified all my scripts in /etc/rc.d/init.d to respond to
>the "stop" parameter so everything gets shutdown smoothly when I
>shutdown my machines.
>
>It might be worth mentioning some of this in the mysql docs.  Not in as
>much detail, perhaps, but certainly a warning that the administrator
>should ensure that mysql is shutdown cleanly when the machine is brought
>down would be appropriate.
>
>R.
>
>---------------------------------------------------------------------
>Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
>posting. To request this thread, e-mail mysql-thread8743@stripped
>
>To unsubscribe, send a message to the address shown in the
>List-Unsubscribe header of this message. If you cannot see it,
>e-mail mysql-unsubscribe@stripped instead.
>
Thread
You should mention /etc/rc0.d/S01mysql in the docstneff28 Jul
  • Re: You should mention /etc/rc0.d/S01mysql in the docsSasha Pachev29 Jul
    • RE: You should mention /etc/rc0.d/S01mysql in the docsTom Neff29 Jul
  • Re: You should mention /etc/rc0.d/S01mysql in the docsRobin Bowes29 Jul
    • Re: You should mention /etc/rc0.d/S01mysql in the docsThimble Smith30 Jul