clean up logging messages

This commit is contained in:
John Bowdre 2022-08-06 21:51:48 -05:00
parent 073f8694f5
commit 9e19e65d7f
2 changed files with 7 additions and 10 deletions

View file

@ -3,9 +3,9 @@ set -e
chmod 600 /syncer/.ssh/id_syncer chmod 600 /syncer/.ssh/id_syncer
echo -e "\n[$(date +"%Y/%m/%d-%H:%M:%S")] Performing initial sync..." 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 "\n[$(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 /syncer/sync.sh delay > /proc/self/fd/1 2>/proc/self/fd/2" >> $CRONTAB_FILE
else else
@ -32,8 +32,8 @@ EOF
fi fi
fi fi
echo -e "\n[$(date +"%Y/%m/%d-%H:%M:%S")] Starting caddy..." 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 "\n[$(date +"%Y/%m/%d-%H:%M:%S")] Starting cron..." echo -e "[$(date +"%Y/%m/%d-%H:%M:%S")] Starting cron..."
exec "$@" exec "$@"

View file

@ -4,19 +4,16 @@ set -e
# insert optional random delay # insert optional random delay
if [ x$1 == x"delay" ]; then if [ x$1 == x"delay" ]; then
echo -e "\n[$(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 + 1 ))
echo -e "[$(date +"%Y/%m/%d-%H:%M:%S")] Sync starts NOW!"
else
echo -e "\n[$(date +"%Y/%m/%d-%H:%M:%S")] Immediate sync starts NOW!"
fi fi
echo -e "[$(date +"%Y/%m/%d-%H:%M:%S")] Sync sync starts NOW!"
# sync # sync
echo -e "[$(date +"%Y/%m/%d-%H:%M:%S")] Rsyncing content..."
/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 -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' -p /syncer/library/
echo -e "[$(date +"%Y/%m/%d-%H:%M:%S")] Sync tasks complete!\n" echo -e "[$(date +"%Y/%m/%d-%H:%M:%S")] Sync tasks complete!"