Hi,
This patch fixes returning values and messages of service "cgred".
Current "cgred" returns 0 (meaning success) even if printing "FAILED"
on starting "cgred" twice:
# service cgred start
Starting CGroup Rules Engine Daemon...
cgred is already running with PID 17680 [FAILED]
# echo $?
0
#
Also, "cgred" prints "OK" even if returning !0 on stopping "cgred"
twice:
# service cgred stop
Stopping CGroup Rules Engine Daemon...
[ OK ]
# echo $?
7
#
By applying this patch, "cgred" prints right messages and returns
right values.
Thanks
Ken'ichi Ohmichi
Signed-off-by: Ken'ichi Ohmichi <[email protected]>
---
scripts/init.d/cgred.in | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/scripts/init.d/cgred.in b/scripts/init.d/cgred.in
index db9c2ac..29f7b43 100644
--- a/scripts/init.d/cgred.in
+++ b/scripts/init.d/cgred.in
@@ -65,7 +65,8 @@ start()
echo $"Starting CGroup Rules Engine Daemon..."
if [ -f "/var/lock/subsys/$servicename" ] ; then
log_failure_msg "$servicename is already running with PID `cat
${pidfile}`"
- return 1
+ RETVAL=1
+ return
fi
daemon --check $servicename --pidfile $pidfile $CGRED_BIN $OPTIONS
RETVAL=$?
@@ -83,8 +84,14 @@ stop()
if [ $RETVAL -eq 0 ] ; then
rm -f /var/lock/subsys/$servicename
rm -f $pidfile
+ log_success_msg
+ else
+ if [ -f /var/lock/subsys/$servicename ] ; then
+ log_failure_msg "Process $processname does not exist."
+ else
+ log_failure_msg "$servicename is not running."
+ fi
fi
- log_success_msg
}
# See how we are called
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Libcg-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libcg-devel