From c54331fa3d9597ba6bc85e7b7242981f00ed25c2 Mon Sep 17 00:00:00 2001 From: Liam Crilly Date: Tue, 4 Apr 2023 11:29:53 +0100 Subject: Tools: use control socket and log file from running instance. If unitd was started with an explicit path then unitc will use that binary instead of the default PATH to obtain the default control socket and log file locations. --- tools/unitc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/unitc b/tools/unitc index 71fef314..9973e62d 100755 --- a/tools/unitc +++ b/tools/unitc @@ -134,7 +134,7 @@ if [ $REMOTE -eq 0 ]; then PARAMS=$(ps $PID | grep unitd | cut -f2- -dv | tr '[]' ' ' | cut -f3- -d ' ' | sed -e 's/ --/\n--/g') CTRL_ADDR=$(echo "$PARAMS" | grep '\--control' | cut -f2 -d' ') if [ "$CTRL_ADDR" = "" ]; then - CTRL_ADDR=$(`echo "$PARAMS" | grep unitd` --help | grep -A1 '\--control' | tail -1 | cut -f2 -d\") + CTRL_ADDR=$($(echo "$PARAMS" | grep unitd) --help | grep -A1 '\--control' | tail -1 | cut -f2 -d\") fi # Prepare for network or Unix socket addressing @@ -156,7 +156,7 @@ if [ $REMOTE -eq 0 ]; then # ERROR_LOG=$(echo "$PARAMS" | grep '\--log' | cut -f2 -d' ') if [ "$ERROR_LOG" = "" ]; then - ERROR_LOG=$(unitd --help | grep -A1 '\--log' | tail -1 | cut -f2 -d\") + ERROR_LOG=$($(echo "$PARAMS" | grep unitd) --help | grep -A1 '\--log' | tail -1 | cut -f2 -d\") fi # Cache the discovery for this unit PID (and cleanup any old files) -- cgit