[fedora-virt] [PATCHES] fix some errors in ksm{,tuned} scripts

Dan Kenigsberg danken at redhat.com
Sat Jul 3 07:02:27 UTC 2010


Justin,
Please consider the attached patches. And remember gitorious repo ;-)
It would be nice if authorship is kept when you push stuff into
there.

Dan.
-------------- next part --------------
>From 36e38a206818639237f31daf611ae0f7c83d0abd Mon Sep 17 00:00:00 2001
From: Andrea Arcangeli <aarcange at redhat.com>
Date: Fri, 2 Jul 2010 17:35:39 +0200
Subject: [PATCH 1/2] fix some error in ksmd.init

return $RETVAL seems unnecessary as nothing checks the retval of the
start() function.

added condrestart|try-restart and force-reload.

Return 2 (3 not) with invalid parameters.

Update usage verbs.

Signed-off-by: Andrea Arcangeli <aarcange at redhat.com>
---
 ksm.init |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/ksm.init b/ksm.init
index 45d617d..8561993 100644
--- a/ksm.init
+++ b/ksm.init
@@ -46,7 +46,6 @@ start() {
     RETVAL=$?
     [ $RETVAL = 0 ] && success $"$prog startup" || failure $"$prog startup"
     echo
-    return $RETVAL
 }
 
 stop() {
@@ -70,6 +69,11 @@ status() {
     fi; fi
 }
 
+restart() {
+    stop
+    start
+}
+
 case "$1" in
   start)
 	start
@@ -81,14 +85,18 @@ case "$1" in
         status
 	;;
   restart)
-	stop
-	start
+	restart
 	;;
-  condrestart)
+  condrestart|try-restart)
+	status >/dev/null 2>&1 || exit 0
+	restart
         ;;
+  force-reload)
+	restart
+	;;
   *)
-	echo $"Usage: $prog {start|stop|restart|condrestart|status|help}"
-	RETVAL=3
+	echo $"Usage: $prog {start|stop|restart|force-reload|condrestart|try-restart|status|help}"
+	RETVAL=2
 esac
 
 exit $RETVAL
-- 
1.7.1

-------------- next part --------------
>From 04ae3b93a10a21616266fe33b4d0a5d0d0cc1352 Mon Sep 17 00:00:00 2001
From: Andrea Arcangeli <aarcange at redhat.com>
Date: Fri, 2 Jul 2010 17:36:53 +0200
Subject: [PATCH 2/2] fix some error in ksmtuned.init

Return 2 instead of 3 in case of invalid parameters.

Add try-restart and force-reload.

Add new verbs to usage help line.

Signed-off-by: Andrea Arcangeli <aarcange at redhat.com>
---
 ksmtuned.init |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/ksmtuned.init b/ksmtuned.init
index 2f32f28..e055785 100644
--- a/ksmtuned.init
+++ b/ksmtuned.init
@@ -70,10 +70,10 @@ case "$1" in
         status -p ${pidfile} $prog
 	RETVAL=$?
 	;;
-  restart)
+  restart|force-reload)
 	restart
 	;;
-  condrestart)
+  condrestart|try-restart)
 	condrestart
 	;;
   retune)
@@ -81,8 +81,8 @@ case "$1" in
         RETVAL=$?
         ;;
   *)
-	echo $"Usage: $prog {start|stop|restart|condrestart|status|retune|help}"
-	RETVAL=3
+	echo $"Usage: $prog {start|stop|restart|force-reload|condrestart|try-restart|status|retune|help}"
+	RETVAL=2
 esac
 
 exit $RETVAL
-- 
1.7.1



More information about the virt mailing list