From: Martin Schwenke Date: Mon, 5 Mar 2018 10:02:40 +0000 (+1100) Subject: ctdb-scripts: Drop PID file argument from wrapper X-Git-Tag: talloc-2.1.12~214 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=52cdb03c65504534043311a5afbc43a51ba672af;p=thirdparty%2Fsamba.git ctdb-scripts: Drop PID file argument from wrapper Use the default compile-time PID file. Use a CTDB_PIDFILE environment variable when testing. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/config/ctdb.init b/ctdb/config/ctdb.init index 621a9cbd7a4..e55c4e68add 100755 --- a/ctdb/config/ctdb.init +++ b/ctdb/config/ctdb.init @@ -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 diff --git a/ctdb/config/ctdb.service b/ctdb/config/ctdb.service index 189f2f4c386..627803c51ac 100644 --- a/ctdb/config/ctdb.service +++ b/ctdb/config/ctdb.service @@ -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 diff --git a/ctdb/config/ctdbd_wrapper b/ctdb/config/ctdbd_wrapper index f80eca64fe8..d56fbef7bc6 100755 --- a/ctdb/config/ctdbd_wrapper +++ b/ctdb/config/ctdbd_wrapper @@ -4,14 +4,13 @@ usage () { - echo "usage: ctdbd_wrapper { 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" diff --git a/ctdb/tests/simple/scripts/local_daemons.bash b/ctdb/tests/simple/scripts/local_daemons.bash index d081ab66215..20017d780d6 100644 --- a/ctdb/tests/simple/scripts/local_daemons.bash +++ b/ctdb/tests/simple/scripts/local_daemons.bash @@ -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 ()