Fix initscripts to report stopped cgconfig service as not running
Resolves: #619091
This commit is contained in:
parent
24de2ebc57
commit
e1783ee4c2
123
libcgroup-0.36.2-initscripts.patch
Normal file
123
libcgroup-0.36.2-initscripts.patch
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
Bug 619091 - cgconfig service is always reported as "running"
|
||||||
|
|
||||||
|
commit 023fee998f07499938830a044845eb03b816eea7
|
||||||
|
Author: Ivana Hutarova Varekova <varekova@redhat.com>
|
||||||
|
Date: Wed Jul 14 14:30:48 2010 +0200
|
||||||
|
|
||||||
|
Init scripts patch
|
||||||
|
|
||||||
|
This patch fixes the return values to meet the standarts.
|
||||||
|
|
||||||
|
changed values are:
|
||||||
|
cgconfig:
|
||||||
|
* start action: 6: program is not configured
|
||||||
|
* status action: 3: program is not running
|
||||||
|
|
||||||
|
cgred:
|
||||||
|
* start action: 7: program is not running
|
||||||
|
* start action: 6: program is not configured
|
||||||
|
* status action: 3: program is not running
|
||||||
|
* status action: 2: program is dead and /var/run pid file exists
|
||||||
|
* stop action: 0: if the service is not running
|
||||||
|
|
||||||
|
Signed-off-by: Ivana Hutarova Varekova <varekova@redhat.com>
|
||||||
|
Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
|
||||||
|
|
||||||
|
diff --git a/scripts/init.d/cgconfig.in b/scripts/init.d/cgconfig.in
|
||||||
|
index 9cf2c9a..d716b40 100644
|
||||||
|
--- a/scripts/init.d/cgconfig.in
|
||||||
|
+++ b/scripts/init.d/cgconfig.in
|
||||||
|
@@ -112,6 +112,12 @@ start() {
|
||||||
|
|
||||||
|
if [ $? -eq 0 ]
|
||||||
|
then
|
||||||
|
+ if [ ! -s $CONFIG_FILE ]
|
||||||
|
+ then
|
||||||
|
+ log_failure_msg $CONFIG_FILE "is not configured"
|
||||||
|
+ return 6
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
$CGCONFIGPARSER_BIN -l $CONFIG_FILE
|
||||||
|
retval=$?
|
||||||
|
if [ $retval -ne 0 ]
|
||||||
|
@@ -193,8 +199,10 @@ case $1 in
|
||||||
|
'status')
|
||||||
|
if [ -f /var/lock/subsys/$servicename ] ; then
|
||||||
|
echo "Running"
|
||||||
|
+ exit 0
|
||||||
|
else
|
||||||
|
echo "Stopped"
|
||||||
|
+ exit 3
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
diff --git a/scripts/init.d/cgred.in b/scripts/init.d/cgred.in
|
||||||
|
index db9c2ac..c5b0ed5 100644
|
||||||
|
--- a/scripts/init.d/cgred.in
|
||||||
|
+++ b/scripts/init.d/cgred.in
|
||||||
|
@@ -34,6 +34,7 @@
|
||||||
|
|
||||||
|
prefix=@prefix@;exec_prefix=@exec_prefix@;sbindir=@sbindir@
|
||||||
|
CGRED_BIN=$sbindir/cgrulesengd
|
||||||
|
+CGRED_CONF=/etc/cgrules.conf
|
||||||
|
|
||||||
|
# Sanity checks
|
||||||
|
[ -x $CGRED_BIN ] || exit 1
|
||||||
|
@@ -62,14 +63,21 @@ RETVAL=0
|
||||||
|
|
||||||
|
start()
|
||||||
|
{
|
||||||
|
- echo $"Starting CGroup Rules Engine Daemon..."
|
||||||
|
+ echo -n $"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
|
||||||
|
+ return 0
|
||||||
|
+ fi
|
||||||
|
+ if [ ! -s $CGRED_CONF ]; then
|
||||||
|
+ log_failure_msg "not configured"
|
||||||
|
+ return 6
|
||||||
|
fi
|
||||||
|
daemon --check $servicename --pidfile $pidfile $CGRED_BIN $OPTIONS
|
||||||
|
RETVAL=$?
|
||||||
|
echo
|
||||||
|
+ if [ $RETVAL -ne 0 ]; then
|
||||||
|
+ return 7
|
||||||
|
+ fi
|
||||||
|
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$servicename
|
||||||
|
echo "`pidof $processname`" > $pidfile
|
||||||
|
}
|
||||||
|
@@ -77,6 +85,10 @@ start()
|
||||||
|
stop()
|
||||||
|
{
|
||||||
|
echo -n $"Stopping CGroup Rules Engine Daemon..."
|
||||||
|
+ if [ ! -f $pidfile ]; then
|
||||||
|
+ log_success_msg
|
||||||
|
+ return 0
|
||||||
|
+ fi
|
||||||
|
killproc -p $pidfile $processname -TERM
|
||||||
|
RETVAL=$?
|
||||||
|
echo
|
||||||
|
@@ -84,19 +96,20 @@ stop()
|
||||||
|
rm -f /var/lock/subsys/$servicename
|
||||||
|
rm -f $pidfile
|
||||||
|
fi
|
||||||
|
- log_success_msg
|
||||||
|
}
|
||||||
|
|
||||||
|
# See how we are called
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
start
|
||||||
|
+ RETVAL=$?
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
stop
|
||||||
|
+ RETVAL=$?
|
||||||
|
;;
|
||||||
|
status)
|
||||||
|
- status -p $pidfile $processname
|
||||||
|
+ status -p $pidfile $servicename
|
||||||
|
RETVAL=$?
|
||||||
|
;;
|
||||||
|
restart)
|
Loading…
Reference in New Issue
Block a user