]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
Add some success/error messages to 'cgred' service.
authorKen'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp>
Tue, 7 Apr 2009 00:50:32 +0000 (09:50 +0900)
committerDhaval Giani <dhaval@linux.vnet.ibm.com>
Mon, 13 Apr 2009 11:22:53 +0000 (16:52 +0530)
Hi,

The existing 'cgred' service displays a success message ([ OK ]) when
the service is starting, but it does not display any messages when it
is stopping/reloading. So this patch adds some success/error messages
to 'cgred' service like the following:

 # service cgred start
 Starting CGroup Rules Engine Daemon...
                                                            [  OK  ]
 #

 # service cgred stop
 Stopping CGroup Rules Engine Daemon...
                                                            [  OK  ]
 #

 # service cgred restart
 Stopping CGroup Rules Engine Daemon...
                                                            [  OK  ]
 Starting CGroup Rules Engine Daemon...
                                                            [  OK  ]
 #

 # service cgred reload
 Reloading rules configuration...
                                                            [  OK  ]
 #

This patch's purpose is almost same as the one of 'cgconfig' service:
http://sourceforge.net/mailarchive/forum.php?thread_name=49D9B778.3000900%40mxs.nes.nec.co.jp&forum_name=libcg-devel

Signed-off-by: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp>
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
scripts/init.d/cgred

index 73ca4807f27d85aca07cab1e1a397701214daf6d..fa824dfe77f3a49fd0d7b80c80492a2148379d24 100644 (file)
@@ -67,7 +67,7 @@ start()
 {
        echo $"Starting CGroup Rules Engine Daemon..."
        if [ -f "/var/lock/subsys/$servicename" ] ; then
-               echo "$servicename is already running with PID `cat ${pidfile}`"
+               log_failure_msg "$servicename is already running with PID `cat ${pidfile}`"
                return 1
        fi
        daemon --check $servicename --pidfile $pidfile $processname $OPTIONS
@@ -87,6 +87,7 @@ stop()
                rm -f /var/lock/subsys/$servicename
                rm -f $pidfile
        fi
+       log_success_msg
 }
 
 # See how we are called
@@ -116,9 +117,13 @@ case "$1" in
                        echo $"Reloading rules configuration..."
                        kill -s 12 `cat ${pidfile}`
                        RETVAL=$?
-                       echo
+                       if [ $RETVAL -eq 0 ] ; then
+                               log_success_msg
+                       else
+                               log_failure_msg
+                       fi
                else
-                       echo $"$servicename is not running."
+                       log_failure_msg "$servicename is not running."
                fi
                ;;
        *)