From add3a2865c7a848f6e069e886f7474cd325c6c7e Mon Sep 17 00:00:00 2001 From: Hyperling Date: Mon, 26 May 2025 18:53:19 -0700 Subject: [PATCH] Automatically reload the `/photos/` index files. --- run.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/run.sh b/run.sh index adf5d8d..ced1bcd 100755 --- a/run.sh +++ b/run.sh @@ -78,6 +78,16 @@ npm install # Reset generated index files. echo "`date` - Removing old index files." find files/photos/ -name "*".html -print -delete +{ + http_code=0 + while [[ $http_code != "200" ]]; do + sleep 1 + echo "`date` - Checking if /photos/ is ready yet." + http_code="`curl --silent --fail --w '\n%{http_code}' localhost:8080/photos | tail -n 1`" + echo "`date` - Check for /photos/ responded with '$http_code'." + done + echo "`date` - Finished loading /photos/." +} & ## Main ##