test: properly kill journalctl
sudo journalctl -af -n 1 -u "${WORKER_UNIT}" &
WORKER_JOURNAL_PID=$!
In this snippet, WORKER_JOURNAL_PID is set to the PID of the sudo process.
Sudo doesn't propagate any signals - therefore the child process of sudo
(journalctl in this case) isn't killed when a signal is sent to the parent.
Use pkill -P instead which kills all processes where sudo is the parent.
Signed-off-by: Ondřej Budai <ondrej@budai.cz>
This commit is contained in:
parent
8f91e236f8
commit
e7b3063f7e
5 changed files with 5 additions and 5 deletions
|
|
@ -180,7 +180,7 @@ $AWS_CMD ec2 describe-images \
|
|||
AMI_IMAGE_ID=$(jq -r '.Images[].ImageId' "$AMI_DATA")
|
||||
|
||||
# Stop watching the worker journal.
|
||||
sudo kill ${WORKER_JOURNAL_PID}
|
||||
sudo pkill -P ${WORKER_JOURNAL_PID}
|
||||
|
||||
# NOTE(mhayden): Getting TagSpecifications to play along with bash's
|
||||
# parsing of curly braces and square brackets is nuts, so we just write some
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ build_image() {
|
|||
fi
|
||||
|
||||
# Stop watching the worker journal.
|
||||
sudo kill ${WORKER_JOURNAL_PID}
|
||||
sudo pkill -P ${WORKER_JOURNAL_PID}
|
||||
}
|
||||
|
||||
# Wait for the ssh server up to be.
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ build_image() {
|
|||
fi
|
||||
|
||||
# Stop watching the worker journal.
|
||||
sudo kill ${WORKER_JOURNAL_PID}
|
||||
sudo pkill -P ${WORKER_JOURNAL_PID}
|
||||
}
|
||||
|
||||
# Wait for the ssh server up to be.
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ if [[ $COMPOSE_STATUS != FINISHED ]]; then
|
|||
fi
|
||||
|
||||
# Stop watching the worker journal.
|
||||
sudo kill ${WORKER_JOURNAL_PID}
|
||||
sudo pkill -P ${WORKER_JOURNAL_PID}
|
||||
|
||||
greenprint "👷🏻 Building VM in vSphere"
|
||||
$GOVC_CMD vm.create -u "${GOVMOMI_USERNAME}":"${GOVMOMI_PASSWORD}"@"${GOVMOMI_URL}" \
|
||||
|
|
|
|||
|
|
@ -201,7 +201,7 @@ if [[ $COMPOSE_STATUS != FINISHED ]]; then
|
|||
fi
|
||||
|
||||
# Stop watching the worker journal.
|
||||
sudo kill ${WORKER_JOURNAL_PID}
|
||||
sudo pkill -P ${WORKER_JOURNAL_PID}
|
||||
|
||||
# Download the image.
|
||||
greenprint "📥 Downloading the image"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue