Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Examples: only terminate vtadmin if it was started #13433

Merged
merged 14 commits into from
Jul 5, 2023
17 changes: 13 additions & 4 deletions examples/common/scripts/vtadmin-down.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,17 @@

mattlord marked this conversation as resolved.
Show resolved Hide resolved
source "$(dirname "${BASH_SOURCE[0]:-$0}")/../env.sh"

mattlord marked this conversation as resolved.
Show resolved Hide resolved
echo "Stopping vtadmin-web..."
kill -9 "$(cat "$VTDATAROOT/tmp/vtadmin-web.pid")"
function stop_vtadmin() {
local name="$1"
local file="$2"
mattlord marked this conversation as resolved.
Show resolved Hide resolved

mattlord marked this conversation as resolved.
Show resolved Hide resolved
echo "Stopping vtadmin-api..."
kill -9 "$(cat "$VTDATAROOT/tmp/vtadmin-api.pid")"
if test -e "$file"; then
mattlord marked this conversation as resolved.
Show resolved Hide resolved
echo "Stopping $name..."
kill -9 "$(cat "$file")"
mattlord marked this conversation as resolved.
Show resolved Hide resolved
else
echo "Skipping stopping $name because no pid file."
fi
}

stop_vtadmin "vtadmin-web" "$VTDATAROOT/tmp/vtadmin-web.pid"
stop_vtadmin "vtadmin-api" "$VTDATAROOT/tmp/vtadmin-api.pid"