ctdb-scripts: Drop PID file argument from wrapper
authorMartin Schwenke <martin@meltin.net>
Mon, 5 Mar 2018 10:02:40 +0000 (21:02 +1100)
committerMartin Schwenke <martins@samba.org>
Fri, 9 Mar 2018 06:08:25 +0000 (07:08 +0100)
Use the default compile-time PID file.

Use a CTDB_PIDFILE environment variable when testing.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/config/ctdb.init
ctdb/config/ctdb.service
ctdb/config/ctdbd_wrapper
ctdb/tests/simple/scripts/local_daemons.bash

index 621a9cbd7a4bed08317114436f67a01bc2b869c7..e55c4e68add5643b2f3a3e82b157ec0734da23ac 100755 (executable)
@@ -65,12 +65,12 @@ start()
     case "$CTDB_INIT_STYLE" in
        suse)
            startproc \
-               "$ctdbd_wrapper" "$pidfile" "start"
+               "$ctdbd_wrapper" "start"
            rc_status -v
            ;;
        redhat)
            daemon --pidfile "$pidfile" \
-               "$ctdbd_wrapper" "$pidfile" "start"
+               "$ctdbd_wrapper" "start"
            RETVAL=$?
            echo
            [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ctdb || RETVAL=1
@@ -78,7 +78,7 @@ start()
            ;;
        debian)
            eval start-stop-daemon --start --quiet --background --exec \
-               "$ctdbd_wrapper" "$pidfile" "start"
+               "$ctdbd_wrapper" "start"
            ;;
     esac
 }
@@ -89,11 +89,11 @@ stop()
 
     case "$CTDB_INIT_STYLE" in
        suse)
-           "$ctdbd_wrapper" "$pidfile" "stop"
+           "$ctdbd_wrapper" "stop"
            rc_status -v
            ;;
        redhat)
-           "$ctdbd_wrapper" "$pidfile" "stop"
+           "$ctdbd_wrapper" "stop"
            RETVAL=$?
            # Common idiom in Red Hat init scripts - success() always
            # succeeds so this does behave like if-then-else
@@ -104,7 +104,7 @@ stop()
            return $RETVAL
            ;;
        debian)
-           "$ctdbd_wrapper" "$pidfile" "stop"
+           "$ctdbd_wrapper" "stop"
            log_end_msg $?
            ;;
     esac
index 189f2f4c386f732de23fb0c3562592a7f520a1cd..627803c51ac01b9f4ab97ee282a318daa2e49d45 100644 (file)
@@ -7,8 +7,8 @@ After=network-online.target time-sync.target
 Type=forking
 LimitCORE=infinity
 PIDFile=/run/ctdb/ctdbd.pid
-ExecStart=/usr/sbin/ctdbd_wrapper /run/ctdb/ctdbd.pid start
-ExecStop=/usr/sbin/ctdbd_wrapper /run/ctdb/ctdbd.pid stop
+ExecStart=/usr/sbin/ctdbd_wrapper start
+ExecStop=/usr/sbin/ctdbd_wrapper stop
 KillMode=control-group
 Restart=no
 
index f80eca64fe8da8f96e667b343fc10453aebdd3b0..d56fbef7bc6d6258c04ea6d0929fb58c08b3507b 100755 (executable)
@@ -4,14 +4,13 @@
 
 usage ()
 {
-    echo "usage: ctdbd_wrapper <pidfile> { start | stop }"
+    echo "usage: ctdbd_wrapper { start | stop }"
     exit 1
 }
 
-[ $# -eq 2 ] || usage
+[ $# -eq 1 ] || usage
 
-pidfile="$1"
-action="$2"
+action="$1"
 
 ############################################################
 
@@ -94,9 +93,8 @@ build_ctdb_options ()
     fi
     maybe_set "--reclock"                "$CTDB_RECOVERY_LOCK"
 
-    maybe_set "--pidfile"                "$pidfile"
-
     # build up ctdb_options variable from optional parameters
+    maybe_set "--pidfile"                "$CTDB_PIDFILE"
     maybe_set "--logging"                "$CTDB_LOGGING"
     maybe_set "--nlist"                  "$CTDB_NODES"
     maybe_set "--socket"                 "$CTDB_SOCKET"
index d081ab66215b7ef50001ae837a7774db78aa4279..20017d780d6736f3110f5a633e92bf0d264034a3 100644 (file)
@@ -201,12 +201,12 @@ start_ctdb_1 ()
 
        CTDBD="${VALGRIND} ctdbd --sloppy-start --nopublicipcheck" \
             CTDBD_CONF="$conf" \
-            ctdbd_wrapper "$pidfile" start
+            CTDB_PIDFILE="$pidfile" \
+            ctdbd_wrapper start
 
        if [ -n "$tmp_conf" ] ; then
                rm -f "$tmp_conf"
        fi
-
 }
 
 daemons_start ()
@@ -226,7 +226,8 @@ stop_ctdb_1 ()
        local conf=$(node_conf "$pnn")
 
        CTDBD_CONF="$conf" \
-            ctdbd_wrapper "$pidfile" stop
+                 CTDB_PIDFILE="$pidfile" \
+                 ctdbd_wrapper stop
 }
 
 daemons_stop ()