From e7c1812cb01884d7389b0c3db0b8052fd49cdf1c Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Thu, 16 Jan 2020 15:55:08 +0100 Subject: [PATCH] synchro.sh: sync files in a separate thread --- configs/synchro.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/configs/synchro.sh b/configs/synchro.sh index 44833b1d..8b899baa 100644 --- a/configs/synchro.sh +++ b/configs/synchro.sh @@ -10,16 +10,20 @@ SSH_OPTS="/usr/bin/ssh -p 22 -i ~/.ssh/id_ed25519 -o ControlMaster=auto -o Contr cd "${BASEDIR}" -# Synchronize CA -rsync -e "$SSH_OPTS" -av --delete PKI/shared "${FRONTEND_HOSTNAME}":"${BASEDIR}"/PKI - -I=0 - touch /tmp/stop + +# Synchronize static files in a separate loop (to avoid submissions delays during file synchronization) +while ! [ -f SETTINGS/stop ] || [ /tmp/stop -nt SETTINGS/stop ] +do + rsync -e "$SSH_OPTS" -av --delete FILES "${FRONTEND_HOSTNAME}":"${BASEDIR}" + + sleep 5 +done & + while ! [ -f SETTINGS/stop ] || [ /tmp/stop -nt SETTINGS/stop ] do # Synchronize static files pages - rsync -e "$SSH_OPTS" -av --delete TEAMS SETTINGS FILES "${FRONTEND_HOSTNAME}":"${BASEDIR}" + rsync -e "$SSH_OPTS" -av --delete PKI TEAMS SETTINGS "${FRONTEND_HOSTNAME}":"${BASEDIR}" # Synchronize submissions rsync -e "$SSH_OPTS" -av --ignore-existing --delay-updates --temp-dir=.tmp/ --partial-dir=.tmp/ --remove-source-files "${FRONTEND_HOSTNAME}":"${BASEDIR}"/submissions/ submissions/ @@ -27,4 +31,5 @@ do sleep 0.3 done +wait echo See you