mirror of
https://github.com/jbowdre/library-syncer.git
synced 2024-11-22 01:42:19 +00:00
create default values and let the user specify the library name
This commit is contained in:
parent
32cc001cf3
commit
e252f95a9d
3 changed files with 6 additions and 5 deletions
|
@ -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
|
/syncer/sync.sh > /proc/self/fd/1 2>/proc/self/fd/2
|
||||||
echo -e "[$(date +"%Y/%m/%d-%H:%M:%S")] Creating cron job..."
|
echo -e "[$(date +"%Y/%m/%d-%H:%M:%S")] Creating cron job..."
|
||||||
if [ "$SYNC_DELAY" == "true" ]; then
|
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
|
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
|
fi
|
||||||
chmod 0644 $CRONTAB_FILE
|
chmod 0644 $CRONTAB_FILE
|
||||||
|
|
||||||
|
|
|
@ -5,15 +5,15 @@ set -e
|
||||||
# insert optional random delay
|
# insert optional random delay
|
||||||
if [ x$1 == x"delay" ]; then
|
if [ x$1 == x"delay" ]; then
|
||||||
echo -e "[$(date +"%Y/%m/%d-%H:%M:%S")] Waiting for random delay..."
|
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
|
fi
|
||||||
|
|
||||||
echo -e "[$(date +"%Y/%m/%d-%H:%M:%S")] Sync sync starts NOW!"
|
echo -e "[$(date +"%Y/%m/%d-%H:%M:%S")] Sync sync starts NOW!"
|
||||||
# sync
|
# 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
|
# generate content library manifest
|
||||||
echo -e "[$(date +"%Y/%m/%d-%H:%M:%S")] Generating 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!"
|
echo -e "[$(date +"%Y/%m/%d-%H:%M:%S")] Sync tasks complete!"
|
|
@ -13,6 +13,7 @@ services:
|
||||||
- SYNC_DELAY_MAX_SECONDS=21600
|
- SYNC_DELAY_MAX_SECONDS=21600
|
||||||
- TLS_NAME=library.lab.bowdre.net
|
- TLS_NAME=library.lab.bowdre.net
|
||||||
- TLS_CUSTOM_CERT=true
|
- TLS_CUSTOM_CERT=true
|
||||||
|
- LIBRARY_NAME=Library
|
||||||
ports:
|
ports:
|
||||||
- "80:80/tcp"
|
- "80:80/tcp"
|
||||||
- "443:443/tcp"
|
- "443:443/tcp"
|
||||||
|
|
Loading…
Reference in a new issue