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

The existing 'cgconfig' service does not display any message even if it
succeeds. So this patch adds some success/error messages to 'cgconfig'
service like the following:

 # service cgconfig start
 Starting cgconfig service:                                 [  OK  ]
 #

 # service cgconfig stop
 Stopping cgconfig service:                                 [  OK  ]
 #

 # service cgconfig restart
 Stopping cgconfig service:                                 [  OK  ]
 Starting cgconfig service:                                 [  OK  ]
 #

It makes test of 'cgconfig' service a little easy.

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/cgconfig

index 6e6bcd69eeba94b6de9df3f096d793453eb49b4f..6b01d9c2f0b5a38987b67ff7103ebffef276f501 100644 (file)
@@ -69,6 +69,7 @@ umount_fs() {
 }
 
 start() {
+        echo -n "Starting cgconfig service: "
        if [ -f /var/lock/subsys/$servicename ]
         then
             log_warning_msg "lock file already exists"
@@ -77,11 +78,11 @@ start() {
 
         if [ $? -eq 0 ]
         then
-                #log_progress_msg "Starting cgconfig service: "
                 cgconfigparser -l $CONFIG_FILE
                 retval=$?
                 if [ $retval -ne 0 ]
                 then
+                    log_failure_msg "Failed to parse " $CONFIG_FILE
                     return $retval
                 fi
         fi
@@ -136,7 +137,14 @@ start() {
         done
        
         touch /var/lock/subsys/$servicename
-        return $?
+        retval=$?
+        if [ $retval -ne 0 ]
+        then
+            log_failure_msg "Failed to touch " /var/lock/subsys/$servicename
+            return $retval
+        fi
+        log_success_msg
+        return 0
 }
 
 move_all_to_init_class() {
@@ -169,9 +177,11 @@ move_all_to_init_class() {
 
 
 stop() {
+    echo -n "Stopping cgconfig service: "
     move_all_to_init_class
     umount_fs
     rm -f /var/lock/subsys/$servicename
+    log_success_msg
 }
 
 trapped() {