From e252f95a9d20569e8790847ded993541a80b7e72 Mon Sep 17 00:00:00 2001 From: John Bowdre Date: Sun, 7 Aug 2022 15:44:55 -0500 Subject: [PATCH] create default values and let the user specify the library name --- client/build/entrypoint.sh | 4 ++-- client/build/sync.sh | 6 +++--- client/docker-compose.yaml | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/client/build/entrypoint.sh b/client/build/entrypoint.sh index 11f9894..927a9ea 100644 --- a/client/build/entrypoint.sh +++ b/client/build/entrypoint.sh @@ -7,9 +7,9 @@ echo -e "[$(date +"%Y/%m/%d-%H:%M:%S")] Performing initial sync..." /syncer/sync.sh > /proc/self/fd/1 2>/proc/self/fd/2 echo -e "[$(date +"%Y/%m/%d-%H:%M:%S")] Creating cron job..." if [ "$SYNC_DELAY" == "true" ]; then - echo "$SYNC_SCHEDULE /syncer/sync.sh delay > /proc/self/fd/1 2>/proc/self/fd/2" >> $CRONTAB_FILE + echo "${SYNC_SCHEDULE:-0 21 * * 5} /syncer/sync.sh delay > /proc/self/fd/1 2>/proc/self/fd/2" >> $CRONTAB_FILE else - echo "$SYNC_SCHEDULE /syncer/sync.sh > /proc/self/fd/1 2>/proc/self/fd/2" >> $CRONTAB_FILE + echo "${SYNC_SCHEDULE:-0 21 * * 5} /syncer/sync.sh > /proc/self/fd/1 2>/proc/self/fd/2" >> $CRONTAB_FILE fi chmod 0644 $CRONTAB_FILE diff --git a/client/build/sync.sh b/client/build/sync.sh index 15bd920..4e93e9c 100644 --- a/client/build/sync.sh +++ b/client/build/sync.sh @@ -5,15 +5,15 @@ set -e # insert optional random delay if [ x$1 == x"delay" ]; then echo -e "[$(date +"%Y/%m/%d-%H:%M:%S")] Waiting for random delay..." - sleep $(( RANDOM % SYNC_DELAY_MAX_SECONDS + 1 )) + sleep $(( RANDOM % ${SYNC_DELAY_MAX_SECONDS:-21600} + 1 )) fi echo -e "[$(date +"%Y/%m/%d-%H:%M:%S")] Sync sync starts NOW!" # sync -/usr/bin/rsync -e "ssh -l syncer -p $SYNC_PORT -i /syncer/.ssh/id_syncer -o StrictHostKeyChecking=no" -av --exclude '*.json' $SYNC_PEER:/ /syncer/library +/usr/bin/rsync -e "ssh -l syncer -p ${SYNC_PORT:-2222} -i /syncer/.ssh/id_syncer -o StrictHostKeyChecking=no" -av --exclude '*.json' $SYNC_PEER:/ /syncer/library # generate content library manifest echo -e "[$(date +"%Y/%m/%d-%H:%M:%S")] Generating content library manifest..." -/usr/bin/python3 /syncer/update_library_manifests.py -n 'Library' -p /syncer/library/ +/usr/bin/python3 /syncer/update_library_manifests.py -n "${LIBRARY_NAME:-Library}" -p /syncer/library/ echo -e "[$(date +"%Y/%m/%d-%H:%M:%S")] Sync tasks complete!" \ No newline at end of file diff --git a/client/docker-compose.yaml b/client/docker-compose.yaml index 4055156..a0dda95 100644 --- a/client/docker-compose.yaml +++ b/client/docker-compose.yaml @@ -13,6 +13,7 @@ services: - SYNC_DELAY_MAX_SECONDS=21600 - TLS_NAME=library.lab.bowdre.net - TLS_CUSTOM_CERT=true + - LIBRARY_NAME=Library ports: - "80:80/tcp" - "443:443/tcp"