aboutsummaryrefslogtreecommitdiffstats
path: root/container-core/src/main/sh
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@verizonmedia.com>2021-09-14 15:20:43 +0200
committerBjørn Christian Seime <bjorncs@verizonmedia.com>2021-09-14 15:20:43 +0200
commitee8303e599a51339c40e5bcc424360940b3a0059 (patch)
treec9d34f5a62503edf5010ff016072aec1ed2cd752 /container-core/src/main/sh
parent22b02294155b87e79501a56c44cc679d1c7c5a2c (diff)
Misc code quality improvements to find-pid
Diffstat (limited to 'container-core/src/main/sh')
-rwxr-xr-xcontainer-core/src/main/sh/find-pid12
1 files changed, 6 insertions, 6 deletions
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 <service-config-id>" >&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