Compare commits

..

2 commits

Author SHA1 Message Date
693d93f649 handle files deleted at source 2022-08-22 16:58:37 -05:00
356a301f44 newline at EOF 2022-08-22 16:58:16 -05:00
3 changed files with 8 additions and 4 deletions

View file

@ -1,4 +1,4 @@
:80 { :80 {
root * /syncer/library root * /syncer/library
file_server file_server
} }

View file

@ -40,4 +40,4 @@ echo -e "[$(date +"%Y/%m/%d-%H:%M:%S")] Starting caddy..."
/usr/sbin/caddy start -config /etc/caddy/Caddyfile /usr/sbin/caddy start -config /etc/caddy/Caddyfile
echo -e "[$(date +"%Y/%m/%d-%H:%M:%S")] Starting cron..." echo -e "[$(date +"%Y/%m/%d-%H:%M:%S")] Starting cron..."
exec "$@" exec "$@"

View file

@ -10,10 +10,14 @@ 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 --bwlimit=${SYNC_MAX_BW:-0} -e "ssh -l syncer -p ${SYNC_PORT:-2222} -i /syncer/.ssh/id_syncer -o StrictHostKeyChecking=no" -av --exclude '*.json' $SYNC_PEER:/ /syncer/library /usr/bin/rsync --progress --bwlimit=${SYNC_MAX_BW:-0} -e "ssh -l syncer -p ${SYNC_PORT:-2222} -i /syncer/.ssh/id_syncer -o StrictHostKeyChecking=no" -avh --stats --exclude '*.json' --exclude '.vSphere-HA' $SYNC_PEER:/ /syncer/library --delete || [ $? -eq 23 ] && true
# handle removed files / remove directories
grep '"files": \[\]' /syncer/library/*/item.json -l | xargs rm -f $1
find /syncer/library -type d -empty -delete
# 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_NAME:-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!"