Move photo checking out of run.sh and into its own script.

This commit is contained in:
2025-10-15 05:01:33 -07:00
parent 1cd182b3a9
commit 616663ffe0
2 changed files with 47 additions and 22 deletions

23
run.sh
View File

@@ -123,28 +123,7 @@ log "Removing old index files."
find files/photos/ -name "*".html -print -delete
{
check_main photos
# TBD/TODO: Move this section to check_photos.sh similar to check_git.sh.
count=1
http_code=0
port="${ports%% *}"
photos_uri=":$port/photos/"
beg_time="$SECONDS"
while [[ $http_code != "200" ]]; do
log "Sleeping for '$count' while waiting for $photos_uri to come up."
sleep $count
log "Checking if $photos_uri is available."
http_code="`curl --silent --fail -w '\n%{http_code}' localhost$photos_uri | tail -n 1`"
log "Check for $photos_uri responded with '$http_code'."
if (( $count >= 10 )); then
log "Giving up on loading $photos_uri after '$count' attempts."
break
else
count=$(( count + 1 ))
fi
done
end_time="$SECONDS"
time="$(( $end_time - $beg_time ))"
log "Finished checking for /photos/ after '$time' seconds."
$DIR/check_photos.sh "$ports"
} &
## Main ##