diff --git a/jupyter_dcv_proxy/run-dcv-user-session.sh b/jupyter_dcv_proxy/run-dcv-user-session.sh index f8c71ce..785f3d6 100644 --- a/jupyter_dcv_proxy/run-dcv-user-session.sh +++ b/jupyter_dcv_proxy/run-dcv-user-session.sh @@ -2,13 +2,26 @@ echo "=========================================================" echo "Creating DCV Session:" -echo "dcv create-session --owner ${NB_USER} ${SESSION_ID}" -dcv create-session --owner ${NB_USER} ${SESSION_ID} +export SESSION_ID=$(uuidgen) +echo "dcv create-session --owner ${USER} ${SESSION_ID}" +dcv create-session --owner ${USER} ${SESSION_ID} echo "Listing DCV Sessions" dcv list-sessions -configurable-http-proxy --port ${PORT} --default-target=https://localhost:8443 --insecure --log-level=debug +configurable-http-proxy --port ${PORT} --default-target=https://localhost:8443 --insecure --log-level=debug & + + +while true; do + + dcv describe-session "${SESSION_ID}" || { + echo >&2 "DCV session ${SESSION_ID} exited unexpectedly. Starting new session" + SESSION_ID=$(openssl rand -hex 12) + dcv create-session --owner $USER ${SESSION_ID} + } + sleep 10 + +done echo "========================================================="