From 31917f1cec7c1ed858df06897d85ba0a0730f31c Mon Sep 17 00:00:00 2001 From: Rob Court Date: Wed, 17 Jul 2024 16:14:50 +0100 Subject: [PATCH] Fix to ensure git pulls don't lockup loading --- scripts/startup.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/scripts/startup.sh b/scripts/startup.sh index 5bc6921..f8c6650 100644 --- a/scripts/startup.sh +++ b/scripts/startup.sh @@ -1,5 +1,19 @@ #!/bin/bash -for folder in $(find /opt/ | grep '/\.git$') ; do git --git-dir=$folder pull || : ; done; +TIMEOUT_DURATION=30 +DELAY_DURATION=50 + +# Function to perform git pulls with timeout and delay +perform_git_pulls() { + for folder in $(find / -type d -name ".git"); do + # Perform the git pull with a timeout + timeout $TIMEOUT_DURATION git --git-dir="$folder" pull || : + # Wait for the specified delay duration + sleep $DELAY_DURATION + done +} + +# Run the perform_git_pulls function as a subprocess +(perform_git_pulls &) /root/anaconda3/bin/jupyter lab --ip='*' --NotebookApp.password="${JUPYPASS}" --no-browser --port 80 --allow-root