KASM-5378 Update vnc_startup.sh to wait until recorder service terminates in case of Xvnc being killed

This commit is contained in:
Mariusz Marciniak 2024-01-17 13:02:37 +01:00
parent bc933d9187
commit a054d3b689
No known key found for this signature in database

View File

@ -353,6 +353,19 @@ function ensure_recorder_running () {
fi fi
} }
function ensure_recorder_terminates_gracefully () {
local kasm_recorder_process="/dockerstartup/recorder/kasm_recorder_service"
while true
do
recorder_pid=$(pgrep -f "$kasm_recorder_process") || true
if [[ -z $recorder_pid ]]; then
break
fi
sleep 1
done
}
############ END FUNCTION DECLARATIONS ########### ############ END FUNCTION DECLARATIONS ###########
@ -452,6 +465,14 @@ do
;; ;;
window_manager) window_manager)
echo "Window manager crashed, restarting" echo "Window manager crashed, restarting"
if [[ ${KASM_SVC_RECORDER:-1} == 1 ]]; then
echo "Waiting for recorder service to upload all pending recordings"
ensure_recorder_terminates_gracefully
echo "Recorder service has terminated, exiting container"
exit 1
fi
start_window_manager start_window_manager
;; ;;
kasm_audio_out_websocket) kasm_audio_out_websocket)