modified rc6 script for slotted server. Return status OK if at least on server is...
authorFrancesco Riosa <vivo@gentoo.org>
Sun, 20 Nov 2005 13:37:21 +0000 (13:37 +0000)
committerFrancesco Riosa <vivo@gentoo.org>
Sun, 20 Nov 2005 13:37:21 +0000 (13:37 +0000)
Package-Manager: portage-2.0.53_rc6

dev-db/mysql/ChangeLog
dev-db/mysql/files/digest-mysql-3.23.58-r1
dev-db/mysql/files/mysql-slot.rc6

index 15f4ea41d24c24741b018cf98e82816f0933aa71..ccb2aedbfba311509ee6598d2398d8ccd897cea2 100644 (file)
@@ -1,6 +1,10 @@
 # ChangeLog for dev-db/mysql
 # Copyright 2002-2005 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/dev-db/mysql/ChangeLog,v 1.261 2005/11/19 03:58:40 vivo Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-db/mysql/ChangeLog,v 1.262 2005/11/20 13:37:20 vivo Exp $
+
+  20 Nov 2005; Francesco Riosa <vivo@gentoo.org> files/mysql-slot.rc6:
+  modified rc6 script for slotted server. Return status OK if at least on server
+  is started.
 
   19 Nov 2005; Francesco Riosa <vivo@gentoo.org> +files/mysql-slot.conf.d,
   +files/mysql-slot.rc6:
index 3a6dd30d9c0fd0fb2f261109c700198ecb651131..70bf4d4b27671cfa85d5771cc87b078b6dae4a79 100644 (file)
@@ -1,2 +1,2 @@
 MD5 835a96c86132fbde0db36db60c5b34cd mysql-3.23.58.tar.gz 12039843
-MD5 5a936d382232f7b4b15fc7d025e9fa8e mysql-extras-20050920.tar.bz2 51007
+MD5 c0c0a0e816f38bc6cbd2fa5c2ef82423 mysql-extras-20050920.tar.bz2 51007
index 1b9ceb96381321cb1f416cff23e310bb0930ab00..75efdb637d5c7d30d3bd3e049a395cdf1589f4b7 100644 (file)
@@ -1,7 +1,7 @@
 #!/sbin/runscript
 # Copyright 1999-2004 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/dev-db/mysql/files/mysql-slot.rc6,v 1.1 2005/11/19 03:58:41 vivo Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-db/mysql/files/mysql-slot.rc6,v 1.2 2005/11/20 13:37:21 vivo Exp $
 
 # external binaryes used: which, sed, tac
 
@@ -13,6 +13,7 @@ depend() {
 function in_list() {
        local elem=${1:-"none"}
        local list=${2:-","}
+
        [[ "${list}" == "${list/,${elem},/}" ]] \
                && return 1 \
                || return 0
@@ -99,24 +100,24 @@ get_slot_config() {
        for my_default in ${my_defaults}; do
                case "${my_default}" in
                        --basedir=*)
-                               if ! $(in_list "${my_default%%=*}" "${paramlist}") ; then
+                               if ! in_list "${my_default%%=*}" "${paramlist}" ; then
                                        basedir="${my_default#--basedir=}"
                                fi ;;
                        --datadir=*)
-                               if ! $(in_list "${my_default%%=*}" "${paramlist}") ; then
+                               if ! in_list "${my_default%%=*}" "${paramlist}" ; then
                                        datadir="${my_default#--datadir=}"
                                fi ;;
                        --pid-file=*)
-                               if ! $(in_list "${my_default%%=*}" "${paramlist}") ; then
+                               if ! in_list "${my_default%%=*}" "${paramlist}" ; then
                                        pidfile="${my_default#--pid-file=}"
                                fi ;;
                        --socket=*)
-                               if ! $(in_list "${my_default%%=*}" "${paramlist}") ; then
+                               if ! in_list "${my_default%%=*}" "${paramlist}" ; then
                                        socket="${my_default#--socket=}"
                                fi ;;
                        *)
                                # check into the list of parameters we already have
-                               if ! $(in_list "${my_default%%=*}" "${paramlist}") ; then
+                               if ! in_list "${my_default%%=*}" "${paramlist}" ; then
                                        paramlist="${paramlist}${my_default%%=*},"
                                        unmanagedparams="${unmanagedparams} $(echo "${my_default}" | sed -e 's,\([^=/a-zA-Z0-9_.-]\),\\\1,g')"
                                fi
@@ -132,7 +133,7 @@ get_slot_config() {
        done
 
        for i in "server-id" "log-bin" ; do
-               if ! $(in_list "--${i}" "${paramlist}") ; then
+               if ! in_list "--${i}" "${paramlist}" ; then
                        ewarn "undefined $i, it's good practice set it"
                fi
        done
@@ -171,8 +172,7 @@ start() {
        local globretstatus=1
        local srv_slot srv_num
        # server MUST NOT share same location for these
-       local pidfilelist=','
-       local datadirlist=','
+       local pidfilelist=',' datadirlist=',' socketlist=','
 
        # additional security
        rm -f "${MYSQL_GLOB_PID_FILE}" ; touch "${MYSQL_GLOB_PID_FILE}"
@@ -198,24 +198,28 @@ start() {
                retstatus=0
 
                get_slot_config "${srv_slot}" "${srv_num}" || retstatus=1
-
                # pre_run checks
                [[ "$retstatus" -eq 0 ]] && checkconfig "${datadir}" || retstatus=2
                if [[ "$retstatus" -eq 0 ]] ; then
-                       if $(in_list "${pidfile}" "${pidfilelist}"); then
+                       if in_list "${pidfile}" "${pidfilelist}" ; then
                                retstatus=3
                                eerror "Cowardly refusing to start another server with same ${pidfile}"
                        fi
-                       if $(in_list "${datadir}" "${datadirlist}"); then
+                       if in_list "${datadir}" "${datadirlist}" ; then
                                retstatus=4
                                eerror "Cowardly refusing to start another server with same ${datadir}"
                        fi
+                       if in_list "${socket}" "${socketlist}" ; then
+                               retstatus=5
+                               eerror "Cowardly refusing to start another server with same ${socket}"
+                       fi
                fi
 
                if [[ $retstatus -eq 0 ]] ; then
                        # additional security
                        rm -f ${pidfile} ${socket}
                        ebegin "Starting mysqld${MY_SUFFIX:+"_"}${srv_slot}${srv_num:+"_"}${srv_num} (${MY_CNF})"
+
                        start-stop-daemon --start --quiet --background \
                                ${NICE:+"--nicelevel="}${NICE} \
                                --pidfile="${pidfile}" \
@@ -235,6 +239,10 @@ start() {
                        if [[ ! -S "${socket}" ]] ; then
                                eerror "MySQL${MY_SUFFIX} NOT started (${retstatus})"
                                retstatus=1
+                       else
+                               pidfilelist="${pidfilelist}${pidfile},"
+                               datadirlist="${datadirlist}${datadir},"
+                               socketlist="${socketlist}${socket},"
                        fi
                fi
 
@@ -244,7 +252,7 @@ start() {
                fi
        done
        # successfull if at least one mysqld started
-       eend $retstatus
+       eend $globretstatus
 }
 
 stop () {