Stuart Henderson wrote:
On 2007/09/19 14:48, Tomas wrote:
Watching the thread about startup script I thought of a question about
shutdown script. Is it necessary to shutdown certain services when machine
goes down? Like for example mysql, dovecot, clamav, amavis or openvpn. I've
never saw anybody do that.
For most things, there's no need to worry at all.
>From http://dev.mysql.com/doc/refman/5.0/en/server-shutdown.html ,
mysql does a controlled shutdown when it receives SIGTERM.
Examining the code of halt(8) (in src/sbin/reboot), at normal shutdown
SIGTERM is sent to running processes, then a delay of 2 seconds before
a sync(2), then a delay of 3 seconds followed by SIGKILL to anything
still running.
So the question is, whether mysql has enough time to shut down
before it's killed. If you think it doesn't, you might like to add
something like 'pkill mysqld; sleep 10' to rc.shutdown. (No need
for some 'mysqladmin shutdown' which would mean listing a plain-
text password in the file).
That's an excelent idea. I will use 'pkill mysqld'. But instead of 'sleep 10'
myabe it's better to check every second if mysqld.sock exists?