perm: ensure subprocess gets killed in perm script

Rarely, the child process create from exec line doesn't die when the
main script ends.  Ensure it gets killed.

Change-Id: Ic2e1de9a1a6eeb55fc8eda39201976180f29a7f9
This commit is contained in:
Mosher, Jaymes (jm616v) 2025-04-16 00:49:41 -06:00
parent b22dd131dd
commit d462a29d1f
2 changed files with 7 additions and 0 deletions

View File

@ -211,6 +211,11 @@ fi
echo 0 > "${hash}/exit_code"
{{- end}}
log.INFO 'Putting the daemon to sleep for {{ $perm_loop_sleep_interval }} seconds.'
# Slight sleep to ensure the last log entry gets processed, then ensure the subprocess
# that's formatting entries is killed.
sleep 1
kill $SUB_PID
EOF
chmod 755 {{ .Values.conf.chroot_mnt_path | quote }}/tmp/perm_host.sh

View File

@ -74,6 +74,8 @@ exec >& >(while read line; do
fi
done)
SUB_PID=$!
die(){
# write to stderr any passed error message
if [[ $@ = *[!\ ]* ]]; then