From owner-freebsd-ports-bugs@FreeBSD.ORG Mon Jul 19 09:20:16 2004 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5377A16A50A for ; Mon, 19 Jul 2004 09:20:16 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 399DF43D6A for ; Mon, 19 Jul 2004 09:20:16 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) i6J9KGJq002686 for ; Mon, 19 Jul 2004 09:20:16 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.11/8.12.11/Submit) id i6J9KGJs002685; Mon, 19 Jul 2004 09:20:16 GMT (envelope-from gnats) Resent-Date: Mon, 19 Jul 2004 09:20:16 GMT Resent-Message-Id: <200407190920.i6J9KGJs002685@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Andreas Klemm Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3BB7B16A4CE for ; Mon, 19 Jul 2004 09:18:20 +0000 (GMT) Received: from srv1.cosmo-project.de (srv1.cosmo-project.de [213.83.6.106]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1B1BB43D6A for ; Mon, 19 Jul 2004 09:18:19 +0000 (GMT) (envelope-from andreas@klemm.apsfilter.org) Received: from srv1.cosmo-project.de (localhost [IPv6:::1]) i6J9IHaI003521 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Mon, 19 Jul 2004 11:18:17 +0200 (CEST) (envelope-from andreas@klemm.apsfilter.org) Received: (from uucp@localhost)i6J9IHeQ003519 for FreeBSD-gnats-submit@freebsd.org; Mon, 19 Jul 2004 11:18:17 +0200 (CEST) (envelope-from andreas@klemm.apsfilter.org) Received: from titan.klemm.apsfilter.org (localhost.klemm.apsfilter.org [127.0.0.1]) by klemm.apsfilter.org (8.12.10/8.12.10) with ESMTP id i6J9Hp7V004536 for ; Mon, 19 Jul 2004 11:17:53 +0200 (CEST) (envelope-from andreas@titan.klemm.apsfilter.org) Received: (from andreas@localhost)i6J9Ho87004535; Mon, 19 Jul 2004 11:17:50 +0200 (CEST) (envelope-from andreas) Message-Id: <200407190917.i6J9Ho87004535@titan.klemm.apsfilter.org> Date: Mon, 19 Jul 2004 11:17:50 +0200 (CEST) From: Andreas Klemm To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: ports/69273: update of mysql server start/stop scripts according to rc ng X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Andreas Klemm List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Jul 2004 09:20:16 -0000 >Number: 69273 >Category: ports >Synopsis: update of mysql server start/stop scripts according to rc ng >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Mon Jul 19 09:20:15 GMT 2004 >Closed-Date: >Last-Modified: >Originator: Andreas Klemm >Release: FreeBSD 5.2.1-RELEASE-p8 i386 >Organization: private >Environment: System: FreeBSD titan.klemm.apsfilter.org 5.2.1-RELEASE-p8 FreeBSD 5.2.1-RELEASE-p8 #0: Sun Jul 4 17:11:05 CEST 2004 root@titan.klemm.apsfilter.org:/usr/src/sys/i386/compile/TITAN i386 FreeBSD titan.klemm.apsfilter.org 5.2.1-RELEASE-p8 FreeBSD 5.2.1-RELEASE-p8 #0: Sun Jul 4 17:11:05 CEST 2004 root@titan.klemm.apsfilter.org:/usr/src/sys/i386/compile/TITAN i386 >Description: Had mysql database corruption under FreeBSD 5.2.1-STABLE >How-To-Repeat: Not repeatable (hopefully) >Fix: Update for 4 ports: mysql323-server mysql40-server mysql41-server mysql50-server New mysql-server.sh start/stop script: - new rc-ng style mysql_enable="NO" (defaul) - allows easy configuration of delay if you shutdown server to hopefully avoid races to prevent db corruption mysql_shutdown_delay="5" (defaul) After some weeks my dspam database was suddenly corrupted rendering the anti spam database unuseable. I noted occasionally, not always, that /var couldn't be unmounted successfully if I run system shutdown using Ctrl-Alt-Delete key sequence. Since mysql database is under /var/db is strongly assume, that the corruption happens, because mysql was unable to write all data to database. My mysql database is sometimes busy when server shuts if much new mail comes in, since I run fetching of e-mail batched via UUCP and fetchmail and Im subscribed to many mailinglists and get a lot of SPAM. I suggest another update to mysql server ports: I like the automatically Database Backup Mechanism, which is included in the postgresql port. Providing automatic db updates prevents complete data loss. If Postgresql port can do so, we should add the same type/level of service to mysql database. I can't promise if I do the work, but I would strongly suggest to do such an update. The following files have to be updated - mysql323-server/files/mysql-server.sh - mysql40-server/files/mysql-server.sh - mysql41-server/files/mysql-server.sh - mysql50-server/files/mysql-server.sh with the following script. A creation of a suitable pkg-message file (see apache2 port for example) is the only thing I'd like to pass to the mysql port maintainer ;-) #!/bin/sh # # $FreeBSD$ # # created by Andreas Klemm # # PROVIDE: mysql # REQUIRE: NETWORKING SERVERS # BEFORE: DAEMON # KEYWORD: FreeBSD shutdown # # Add the following lines to /etc/rc.conf to enable mysql: # mysql_enable (bool): Set to "NO" by default. # Set it to "YES" to enable service. # mysql_shutdown_delay (str): Set to "5" seconds by default. # Time to ensure proper db termination on shutdown # . /etc/rc.subr name=mysql rcvar=`set_rcvar` start_cmd="mysql_start" stop_cmd="mysql_stop" restart_cmd="mysql_restart" dbdir=/var/db/mysql mysql_command=/usr/local/bin/mysqld_safe mysql_user=mysql pidfile=${dbdir}/`/bin/hostname -s`.pid mysql_start() { /usr/bin/limits -U $mysql_user \ $mysql_command \ --user=$mysql_user \ --datadir=${dbdir} \ --pid-file=${pidfile} > /dev/null & echo -n ' mysqld' } mysql_stop() { if [ -f ${pidfile} ]; then /bin/kill `cat ${pidfile}` > /dev/null 2>&1 \ && echo -n ' mysqld' sleep $mysql_shutdown_delay else echo "mysql-server isn't running" fi } mysql_restart() { mysql_stop mysql_start } # set defaults [ -z "$mysql_enable" ] && mysql_enable="NO" [ -z "$mysql_shutdown_delay" ] && mysql_shutdown_delay="5" required_dirs=${dbdir} required_files=${dbdir}/mysql/host.frm load_rc_config $name run_rc_command "$1" >Release-Note: >Audit-Trail: >Unformatted: