From ee8303e599a51339c40e5bcc424360940b3a0059 Mon Sep 17 00:00:00 2001 From: Bjørn Christian Seime Date: Tue, 14 Sep 2021 15:20:43 +0200 Subject: Misc code quality improvements to find-pid --- container-core/src/main/sh/find-pid | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'container-core/src/main/sh') diff --git a/container-core/src/main/sh/find-pid b/container-core/src/main/sh/find-pid index 5533488c24d..88c4c7df2aa 100755 --- a/container-core/src/main/sh/find-pid +++ b/container-core/src/main/sh/find-pid @@ -76,23 +76,23 @@ findhost set -euo pipefail -if [ $# -ne 1 ]; then +if (( $# != 1 )); then echo "Usage: $0 " >&2 exit 1 fi -readonly service=$1 -readonly status=$(vespa-sentinel-cmd list 2>/dev/null | grep "id=\"${service}\"") +readonly config_id=$1 +readonly status=$(vespa-sentinel-cmd list 2>/dev/null | grep "id=\"${config_id}\"") if [ -z "${status}" ]; then - echo "No service named '${service}'" >&2 + echo "No service named '${config_id}'" >&2 exit 1 fi readonly pid=$(echo ${status} | cut -d " " -f 4 | cut -d "=" -f 2) if ! [[ "${pid}" =~ ^[0-9]+$ ]]; then - echo "Could not find valid pid for '${service}' (pid='${pid}')" >&2 + echo "Could not find valid pid for '${config_id}' (pid='${pid}')" >&2 exit 1 fi -if ! [ -n $(ps -p ${pid} -o pid=) ]; then +if [ -z "$(ps -p ${pid} -o pid=)" ]; then echo "Could not find process for '${pid}'" >&2 exit 1 fi -- cgit v1.2.3