packages: mysql-proxy/mysql-proxy.init - template.init sync

glen glen at pld-linux.org
Wed Apr 14 11:37:35 CEST 2010


Author: glen                         Date: Wed Apr 14 09:37:35 2010 GMT
Module: packages                      Tag: HEAD
---- Log message:
- template.init sync

---- Files affected:
packages/mysql-proxy:
   mysql-proxy.init (1.8 -> 1.9) 

---- Diffs:

================================================================
Index: packages/mysql-proxy/mysql-proxy.init
diff -u packages/mysql-proxy/mysql-proxy.init:1.8 packages/mysql-proxy/mysql-proxy.init:1.9
--- packages/mysql-proxy/mysql-proxy.init:1.8	Fri Jun 19 11:55:54 2009
+++ packages/mysql-proxy/mysql-proxy.init	Wed Apr 14 11:37:30 2010
@@ -29,69 +29,74 @@
 
 start() {
 	# Check if the service is already running?
-	if [ ! -f /var/lock/subsys/mysql-proxy ]; then
-		msg_starting "MySQL Proxy"
-		local args=${LUA_SCRIPT:+--proxy-lua-script="$LUA_SCRIPT"}
-		for addr in $PROXY_READ_ONLY_BACKEND_ADDRESSES; do
-			args="$args --proxy-read-only-backend-addresses=$addr"
-		done
-		for addr in $PROXY_BACKEND_ADDRESSES; do
-			args="$args --proxy-backend-addresses=$addr"
-		done
-		if [ "$PROXY_ADDRESS" ]; then
-			args="$args --proxy-address=$PROXY_ADDRESS"
-		fi
-		if [ "$ADMIN_ADDRESS" ]; then
-			args="$args --admin-address=$ADMIN_ADDRESS"
-		fi
-		daemon --user mysqlproxy /usr/sbin/mysql-proxy --daemon --pid-file=/var/run/mysql-proxy/mysql-proxy.pid $args
-		RETVAL=$?
-		[ $RETVAL -eq 0 ] && touch /var/lock/subsys/mysql-proxy
-	else
+	if [ -f /var/lock/subsys/mysql-proxy ]; then
 		msg_already_running "MySQL Proxy"
+		return
+	fi
+
+	msg_starting "MySQL Proxy"
+	local args=${LUA_SCRIPT:+--proxy-lua-script="$LUA_SCRIPT"}
+	for addr in $PROXY_READ_ONLY_BACKEND_ADDRESSES; do
+		args="$args --proxy-read-only-backend-addresses=$addr"
+	done
+	for addr in $PROXY_BACKEND_ADDRESSES; do
+		args="$args --proxy-backend-addresses=$addr"
+	done
+	if [ "$PROXY_ADDRESS" ]; then
+		args="$args --proxy-address=$PROXY_ADDRESS"
+	fi
+	if [ "$ADMIN_ADDRESS" ]; then
+		args="$args --admin-address=$ADMIN_ADDRESS"
 	fi
+
+	daemon --user mysqlproxy /usr/sbin/mysql-proxy --daemon --pid-file=/var/run/mysql-proxy/mysql-proxy.pid $args
+	RETVAL=$?
+	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/mysql-proxy
 }
 
 stop() {
-	if [ -f /var/lock/subsys/mysql-proxy ]; then
-		# Stop daemons.
-		msg_stopping "MySQL Proxy"
-		killproc --pidfile /var/run/mysql-proxy/mysql-proxy.pid mysql-proxy
-		rm -f /var/lock/subsys/mysql-proxy
-	else
+	if [ ! -f /var/lock/subsys/mysql-proxy ]; then
 		msg_not_running "MySQL Proxy"
+		return
 	fi
+
+	# Stop daemons.
+	msg_stopping "MySQL Proxy"
+	killproc --pidfile /var/run/mysql-proxy/mysql-proxy.pid mysql-proxy
+	rm -f /var/lock/subsys/mysql-proxy
 }
 
 reload() {
-	if [ -f /var/lock/subsys/mysql-proxy ]; then
-		msg_reloading "MySQL Proxy"
-		killproc --pidfile /var/run/mysql-proxy/mysql-proxy.pid mysql-proxy -HUP
-		RETVAL=$?
-	else
+	if [ ! -f /var/lock/subsys/mysql-proxy ]; then
 		msg_not_running "MySQL Proxy"
 		RETVAL=7
+		return
 	fi
+
+	msg_reloading "MySQL Proxy"
+	killproc --pidfile /var/run/mysql-proxy/mysql-proxy.pid mysql-proxy -HUP
+	RETVAL=$?
 }
 
 condrestart() {
-	if [ -f /var/lock/subsys/mysql-proxy ]; then
-		stop
-		start
-	else
+	if [ ! -f /var/lock/subsys/mysql-proxy ]; then
 		msg_not_running "MySQL Proxy"
 		RETVAL=$1
+		return
 	fi
+
+	stop
+	start
 }
 
 RETVAL=0
 # See how we were called.
 case "$1" in
   start)
-  	start
+	start
 	;;
   stop)
-  	stop
+	stop
 	;;
   restart)
 	stop
@@ -101,7 +106,7 @@
 	condrestart 0
 	;;
   reload|force-reload)
-  	reload
+	reload
 	;;
   status)
 	status mysql-proxy
================================================================

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



More information about the pld-cvs-commit mailing list