SOURCES: preload.init - ionice support

gotar gotar at pld-linux.org
Mon Sep 8 12:44:45 CEST 2008


Author: gotar                        Date: Mon Sep  8 10:44:45 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- ionice support

---- Files affected:
SOURCES:
   preload.init (1.4 -> 1.5) 

---- Diffs:

================================================================
Index: SOURCES/preload.init
diff -u SOURCES/preload.init:1.4 SOURCES/preload.init:1.5
--- SOURCES/preload.init:1.4	Mon Oct  2 22:32:58 2006
+++ SOURCES/preload.init	Mon Sep  8 12:44:39 2008
@@ -19,10 +19,21 @@
 	# Check for > MIN_MEMORY MB
 	free -m | awk '/Mem:/ {exit ($2 >= ('"$MIN_MEMORY"'))?0:1}' || exit 0
 
+	# Check for ionice and use idle scheduling if available
+	RUNAS=""
+	IONICE="/usr/bin/ionice"
+	if [ -n "$IONICE_OPTS" ]; then
+		if [ -x "$IONICE" ]; then
+			RUNAS="$IONICE $IONICE_OPTS"
+		else
+			nls "ionice not found, running with normal IO priority" >&2
+		fi
+	fi
+
 	# Check if the service is already running?
 	if [ ! -f /var/lock/subsys/preload ]; then
 		msg_starting preload
-	    daemon /usr/sbin/preload $PRELOAD_OPTS --statefile /var/lib/misc/preload.state
+		daemon $RUNAS /usr/sbin/preload $PRELOAD_OPTS --statefile /var/lib/misc/preload.state
 		RETVAL=$?
 		[ $RETVAL -eq 0 ] && touch /var/lock/subsys/preload
 	else
@@ -55,17 +66,17 @@
 # See how we were called.
 case "$1" in
   start)
-  	start
+	start
 	;;
   stop)
-  	stop
+	stop
 	;;
   restart)
 	stop
 	start
 	;;
   reload|force-reload)
-  	reload
+	reload
 	;;
   status)
 	status preload
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/preload.init?r1=1.4&r2=1.5&f=u



More information about the pld-cvs-commit mailing list