ctdb.init: behave correctly when calling "service ctdb stop" on stopped service
authorMichael Adam <obnox@samba.org>
Fri, 12 Dec 2008 15:00:07 +0000 (16:00 +0100)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Mon, 15 Dec 2008 22:51:00 +0000 (09:51 +1100)
When "service ctdb stop" is called and the ctdbd is not running,
don't print the "Failed to connect to daemon" error messages.
But print a warning and exit with status success instead.

Michael

config/ctdb.init

index 674298351e4ee6dabfc59445148d7c3c322e4d98..de3acfb571f8edaca75a5c9763dd6e3e7e8a2995 100755 (executable)
@@ -148,6 +148,18 @@ start() {
 
 stop() {
        echo -n $"Shutting down ctdbd service: "
+       ctdb ping >& /dev/null || {
+           echo -n "  Warning: ctdbd not running ! "
+           case $init_style in
+               suse)
+                   rc_status -v
+                   ;;
+               redhat)
+                   echo ""
+                   ;;
+           esac
+           return 0
+       }
        ctdb shutdown
        RETVAL=$?
        count=0