SOURCES: mysql.init - fixed force-reload, added try-restart

qboosh qboosh at pld-linux.org
Tue Oct 14 20:12:48 CEST 2008


Author: qboosh                       Date: Tue Oct 14 18:12:48 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- fixed force-reload, added try-restart

---- Files affected:
SOURCES:
   mysql.init (1.128 -> 1.129) 

---- Diffs:

================================================================
Index: SOURCES/mysql.init
diff -u SOURCES/mysql.init:1.128 SOURCES/mysql.init:1.129
--- SOURCES/mysql.init:1.128	Tue Oct 14 15:21:07 2008
+++ SOURCES/mysql.init	Tue Oct 14 20:12:42 2008
@@ -1,8 +1,8 @@
 #!/bin/sh
 #
-# mysql         A very fast and reliable SQL database engine
+# mysql		A very fast and reliable SQL database engine
 #
-# chkconfig:    2345 84 25
+# chkconfig:	2345 84 25
 #
 # description:  A very fast and reliable SQL database engine.
 #
@@ -246,7 +246,7 @@
 	rm -f "$MYSQL_PIDFILE"
 
 	TMPDIR=/tmp nice -n ${SERVICE_RUN_NICE_LEVEL:-$DEFAULT_SERVICE_RUN_NICE_LEVEL} \
-   		/usr/bin/setsid /usr/sbin/mysqld \
+		/usr/bin/setsid /usr/sbin/mysqld \
 			--defaults-file=$MYSQL_CONFIG \
 			--datadir=$MYSQL_DATA_DIR \
 			--pid-file=$MYSQL_PIDFILE $MYSQL_OPTIONS \
@@ -508,6 +508,16 @@
 	mysqlsubsys
 }
 
+condrestart() {
+	if [ -f /var/lock/subsys/mysql ]; then
+		stop
+		start
+	else
+		msg_not_running "MySQL"
+		RETVAL=$1
+	fi
+}
+
 RETVAL=0
 case "$action" in
   start)
@@ -516,6 +526,16 @@
   stop)
   	stop
 	;;
+  restart)
+	stop
+	start
+	;;
+  try-restart)
+	condrestart 0
+	;;
+  force-reload)
+	condrestart 7
+	;;
   status)
 	for mysqldir in $DB_CLUSTERS; do
 		mysqlstatus "$mysqldir"
@@ -555,10 +575,6 @@
 		done
 	fi
 	;;
-  restart|force-reload)
-	stop
-	start
-	;;
   init)
 	for mysqldir in $DB_CLUSTERS; do
 		mysqlinit "$mysqldir"
@@ -575,7 +591,7 @@
 	done
 	;;
   *)
-	msg_usage "$0 {start|stop|init|restart|force-reload|status}"
+	msg_usage "$0 {start|stop|init|restart|try-restart|force-reload|status}"
 	exit 3
 esac
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/mysql.init?r1=1.128&r2=1.129&f=u



More information about the pld-cvs-commit mailing list