packages: mysql/mysql.init - make mysql.init a bit more lsb-compatible - wh...

mmazur mmazur at pld-linux.org
Wed Jul 27 15:34:29 CEST 2011


Author: mmazur                       Date: Wed Jul 27 13:34:29 2011 GMT
Module: packages                      Tag: HEAD
---- Log message:
- make mysql.init a bit more lsb-compatible
- when running `mysql status` on a server where /var/lib/mysql isn't mounted,
  don't return 6 (AAAAA!!!!! UNKNOWN ERROR!!!!!), but 3 (everythin' cool, 
  service just not running, move along)

---- Files affected:
packages/mysql:
   mysql.init (1.147 -> 1.148) 

---- Diffs:

================================================================
Index: packages/mysql/mysql.init
diff -u packages/mysql/mysql.init:1.147 packages/mysql/mysql.init:1.148
--- packages/mysql/mysql.init:1.147	Wed Jul 27 14:25:48 2011
+++ packages/mysql/mysql.init	Wed Jul 27 15:34:24 2011
@@ -102,7 +102,7 @@
 	clusterdir="$1"
 	mode="$2"
 	
-	mysqlgetconfig "$clusterdir"
+	mysqlgetconfig "$clusterdir" status
 
 	MYSQL_STATUS="not running"
 	MYSQL_PID="unknown"
@@ -153,9 +153,11 @@
 #
 # arguments
 # $1 - db cluster
+# $2 - status | other
 
 mysqlgetconfig() {
 	local clusterdir="$1" config_file
+	local mode="$2"
 
 	# emulate old behaviour if only one cluster specified
 	if [ "$clusterdir" = "$MYSQL_DB_CLUSTERS" -a "$clusterdir" = "/var/lib/mysql" -a -f /etc/mysqld.conf ]; then
@@ -176,7 +178,11 @@
 
 	if [ -z "$config_file" ]; then
 		nls "Error: Can't find config file for %s cluster" "$clusterdir"
-		exit 6
+		if [ "$mode" = "status" ]; then 
+			exit 3
+		else
+			exit 6
+		fi
 	else
 		MYSQL_CONFIG="$config_file"
 	fi
@@ -184,7 +190,11 @@
 	if [ ! -f "$config_file" ]; then
 		nls "Error: config file %s not found" "$config_file"
 		nls "MySQL can't be run. Did you initialize DB by doing \`$0 init'?"
-		exit 6
+		if [ "$mode" = "status" ]; then 
+			exit 3
+		else
+			exit 6
+		fi
 	fi
 
 	# reset to initial state
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/mysql/mysql.init?r1=1.147&r2=1.148&f=u



More information about the pld-cvs-commit mailing list