mirror of
https://github.com/jbowdre/library-syncer.git
synced 2024-11-27 03:32:18 +00:00
19 lines
No EOL
733 B
Bash
19 lines
No EOL
733 B
Bash
#!/bin/sh
|
|
|
|
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:-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:-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_NAME:-Library}" -p /syncer/library/
|
|
|
|
echo -e "[$(date +"%Y/%m/%d-%H:%M:%S")] Sync tasks complete!" |