KASM-5378 Add while loop to wait the 15 seconds

This commit is contained in:
Richard Koliser 2024-01-09 12:33:25 -05:00
parent 5c8e3b9e92
commit 2892f64b84
No known key found for this signature in database

View File

@ -324,13 +324,19 @@ function ensure_recorder_running () {
if [[ -f "$kasm_recorder_ack" ]]; then
local ack_user=$(stat -c '%U' $kasm_recorder_ack)
if [[ "$ack_user" == "kasm-recorder" ]]; then
SECONDS=0
SECONDS=0 #SECONDS is a built in bash variable that is incremented approximately every second
kasm_recorder_pid=""
fi
fi
local recorder_pid=$(pgrep -f "^$kasm_recorder_process") || true
while [ $SECONDS -lt 16 ] && [[ -z $recorder_pid ]]
do
local recorder_pid=$(pgrep -f "^$kasm_recorder_process") || true
sleep 1
done
if [[ -z $kasm_recorder_pid ]]; then
if [[ -z $recorder_pid ]] && (( $SECONDS > 15 )); then
echo "$kasm_recorder_process: not started, exiting"