Skip to content

Commit

Permalink
issue #115 instance name safety net
Browse files Browse the repository at this point in the history
  • Loading branch information
zackmay committed Jul 10, 2024
1 parent 8bf15d4 commit aaf705c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions varnishgather
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,14 @@ done

shift $((OPTIND - 1))

if [ -z "$NAME" ]; then
VARNISHD_CMD=$(ps -o cmd= -p $(pgrep varnishd))
if echo "$VARNISHD_CMD" | grep -q '\-n'; then
INSTANCE_NAME=$(echo "$VARNISHD_CMD" | grep -oP '(?<=-n )\S+')
NAME="-n $INSTANCE_NAME"
fi
fi

if [ $# -gt 0 ]
then
info "Unknown argument: $1"
Expand Down

0 comments on commit aaf705c

Please sign in to comment.