r2757 - trunk/bootscripts/blfs/init.d

dj at linuxfromscratch.org dj at linuxfromscratch.org
Tue Sep 28 18:23:57 PDT 2004


Author: dj
Date: 2004-09-28 19:23:56 -0600 (Tue, 28 Sep 2004)
New Revision: 2757

Modified:
   trunk/bootscripts/blfs/init.d/mysql
   trunk/bootscripts/blfs/init.d/winbind
Log:
use PIDFILE in winbind and mysql (bz875).

Modified: trunk/bootscripts/blfs/init.d/mysql
===================================================================
--- trunk/bootscripts/blfs/init.d/mysql	2004-09-29 01:15:13 UTC (rev 2756)
+++ trunk/bootscripts/blfs/init.d/mysql	2004-09-29 01:23:56 UTC (rev 2757)
@@ -7,27 +7,28 @@
 . /etc/sysconfig/rc
 . $rc_functions
 
-pid_file=/srv/mysql/`/bin/hostname`.pid
+PIDFILE=/srv/mysql/`/bin/hostname`.pid
+KILLDELAY=20
 
 case "$1" in
 	start)
 		echo "Starting MySQL daemon..."
 		failure=0
-		if test -f "$pid_file"
+		if [ -f "$PIDFILE" ]
 		then
-			if /bin/ps p `cat $pid_file` | grep mysqld >/dev/null
+			if /bin/ps p `cat $PIDFILE` | grep mysqld >/dev/null
 			then
 				print_status warning running
 				exit 0
 			else
-				rm -f $pid_file
-				if test -f $pid_file
+				rm -f "$PIDFILE"
+				if [ -f "$PIDFILE" ]
 				then
 					failure=1
 				fi
 			fi
 		fi
-		if [ $failure = 1 ]
+		if [ "$failure" = "1" ]
 		then
 			print_status failure
 		else
@@ -38,24 +39,15 @@
 
 	stop)
 		echo "Stopping MySQL daemon..."
-		if test -s "$pid_file"
+		if [ -e "$PIDFILE" ]
 		then
-			kill `cat $pid_file`
-			sleep 1
-			failure=0
-			while [ -s $pid_file -a "$flags" != aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ]
-			do
-				[ -z "$flags" ]
-				flags=a$flags
-				sleep 1
-			done
-			if [ -s $pid_file ]
-				then failure=1
-			fi
-			(exit $failure)
-			evaluate_retval
+			killproc
 		else
 			print_status warning not_running
+			if [ -e "$PIDFILE" ]
+			then
+				rm -f $PIDFILE
+			fi
 		fi
 		;;
 

Modified: trunk/bootscripts/blfs/init.d/winbind
===================================================================
--- trunk/bootscripts/blfs/init.d/winbind	2004-09-29 01:15:13 UTC (rev 2756)
+++ trunk/bootscripts/blfs/init.d/winbind	2004-09-29 01:23:56 UTC (rev 2757)
@@ -7,54 +7,19 @@
 source /etc/sysconfig/rc
 source $rc_functions
 
+PIDFILE="/var/run/winbindd.pid"
+KILLDELAY="10"
+
 case "$1" in
 
         start)
                 echo "Starting winbind..."
-                loadproc /usr/sbin/winbindd
+                loadproc winbindd
                 ;;
 
         stop)
                 echo "Stopping winbind..."
-                if [ -e /var/run/winbindd.pid ]
-                then
-                    localpid=$(cat /var/run/winbindd.pid)
-                else
-                    localpid=""
-                fi
-                if [ -n "$localpid" ]
-                then
-                    i=0
-                    kill -TERM $localpid 2>/dev/null
-		    sleep 3
-		    ps -A | grep $localpid 2>/dev/null
-		    if [ $?  == "0" ]
-		    then
-			while [ $i -lt 3 ]
-                	do
-                            kill -0 $localpid 2>/dev/null || break
-                            sleep 1
-                            i=$(($i+1))
-                        done
-			# if we are still running hit the fall back
-			# signal (KILL)
-                        ps -A | grep $localpid 2>/dev/null
-			if [ $? == "0" ]
-			then
-			    kill -KILL $localpid 2>/dev/null
-			    sleep 3
-			    failure=1
-			fi
-		    else
-			failure=0
-			rm -f /var/run/winbindd.pid
-		    fi
-                    (exit $failure)
-                    evaluate_retval
-                else
-                    print_status warning not_running
-                fi
-                ;;
+		killproc winbindd
 
 	reload)
 		echo "Reloading winbind..."
@@ -68,7 +33,7 @@
                 ;;
 
         status)
-                statusproc /usr/sbin/winbindd
+                statusproc winbindd
                 ;;
 
         *)




More information about the blfs-book mailing list