[csw-devel] SF.net SVN: gar:[12179] csw/mgar/pkg/mysql5/branches/mysql-5.0.x/files/ cswmysql5

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Tue Jan 4 21:13:00 CET 2011


Revision: 12179
          http://gar.svn.sourceforge.net/gar/?rev=12179&view=rev
Author:   wahwah
Date:     2011-01-04 20:13:00 +0000 (Tue, 04 Jan 2011)

Log Message:
-----------
mysql-5.0.x: Bugfixes #0004646 and #0004653

#0004646: If /etc/opt/csw/mysql5/my.cnf is present, ignore
/opt/csw/mysql5/my.cnf

#0004653: Pass current zone name to pgrep and pkill if /bin/zonename is
present

Modified Paths:
--------------
    csw/mgar/pkg/mysql5/branches/mysql-5.0.x/files/cswmysql5

Modified: csw/mgar/pkg/mysql5/branches/mysql-5.0.x/files/cswmysql5
===================================================================
--- csw/mgar/pkg/mysql5/branches/mysql-5.0.x/files/cswmysql5	2011-01-04 16:29:10 UTC (rev 12178)
+++ csw/mgar/pkg/mysql5/branches/mysql-5.0.x/files/cswmysql5	2011-01-04 20:13:00 UTC (rev 12179)
@@ -16,11 +16,12 @@
 #
 
 RETVAL=0
-BASEDIR="/opt/csw/mysql5"
-MYSQL_HOME="/var${BASEDIR}"
-sysconfdir="/etc${BASEDIR}"
-MYSQLD_DATADIR=$MYSQL_HOME
-MYSQLD_PID_FILE=$MYSQL_HOME/mysql.pid
+prefix="/opt/csw/mysql5"
+BASEDIR="${prefix}"
+MYSQL_VAR="/var${prefix}"
+sysconfdir="/etc${prefix}"
+MYSQLD_DATADIR=$MYSQL_VAR
+MYSQLD_PID_FILE=$MYSQL_VAR/mysql.pid
 CONFFILE=${sysconfdir}/my.cnf
 
 #
@@ -28,6 +29,11 @@
 [ -r /opt/csw/mysql5/etc/mysql5rc ] && . /opt/csw/mysql5/etc/mysql5rc
 [ -r /etc/opt/csw/mysql5rc ] && . /etc/opt/csw/mysql5rc
 
+if [ -r "${sysconfdir}/my.cnf" ]; then
+  MYSQL_HOME="${MYSQL_VAR}"
+elif [ -r "${BASEDIR}/my.cnf" ]; then
+  MYSQL_HOME="${BASEDIR}"
+fi
 export MYSQL_HOME
 
 # To get started quickly, copy a sample configuration file from
@@ -149,7 +155,7 @@
 
     printf "%-60s" "Shutting down mysqld: "
     if test -f "$MYSQLD_PID_FILE" ; then
-        pkill mysqld_safe >/dev/null 2>&1
+        pkill `pgrep_opts` mysqld_safe >/dev/null 2>&1
         kill `cat $MYSQLD_PID_FILE` >/dev/null 2>&1
         RETVAL=$?
     else
@@ -164,6 +170,13 @@
     return 0
 }
 
+pgrep_opts() {
+  if [ -x /bin/zonename ]
+  then
+    echo "-z `/bin/zonename`"
+  fi
+}
+
 case $1 in
     start)
     start_it
@@ -175,13 +188,7 @@
 
     restart)
     stop_it
-    if [ -x /bin/zonename ]
-    then
-      pgrep_opts="-z `/bin/zonename`"
-    else
-      pgrep_opts=""
-    fi
-    while pgrep ${pgrep_opts} mysqld > /dev/null
+    while pgrep `pgrep_opts` mysqld > /dev/null
       do
       sleep 1
     done


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


More information about the devel mailing list