eid-ops/natmd-common/overlay/opt/mdqp/post.d/97-rsync

23 lines
587 B
Bash
Executable file

#!/usr/bin/env bash
set -e
lock_file="/opt/mdqp/rsync_lock"
if [ ! -r "${lock_file}" ]; then
echo "No lock_file (${lock_file}) found. Skipping rsync to publishers."
exit 0
else
sync_host=$(cat "${lock_file}")
fi
my_hostname=$(hostname -f)
if [ "${sync_host}x" != "${my_hostname}x" ]; then
echo "I'm not the sync host (${sync_host}). Skipping rsync to publishers."
exit 0
fi
for publisher in natpub-1.komreg.net natpub-2.komreg.net; do
echo "rsync to ${publisher}"
rsync -a --exclude "/status/" --delete /opt/mdqp/work/signed_metadata/ ${publisher}:
done