rsync: bug fixes.

This commit is contained in:
Ossi Herrala 2013-11-05 12:59:20 +00:00
parent faa453c544
commit a8a1ba59a0
2 changed files with 12 additions and 6 deletions

View file

@ -1,19 +1,19 @@
#!/bin/bash
LOGFILE="/srv/rsync-log/<%= @source_host -%>-$(date +"%F-%T").log"
LOGFILE="/srv/rsync-log/<%= @_log_host -%>-$(date +"%F-%T").log"
FLOCK="/usr/bin/flock"
FLOCK_OPTS="--exclusive --nonblock"
FLOCK_FILE="/var/lock/<%= @name -%>"
RSYNC="/usr/bin/rsync"
RSYNC_OPTS="-ax <%= @acl ? "-A" : "" -%> --delete --itemize-changes <%= @_excludes -%>"
RSYNC_OPTS=( -ax <%= @acl ? "-A" : "" -%> --delete --itemize-changes <%= @_excludes -%> )
(
$FLOCK $FLOCK_OPTS 200 || exit $?
/usr/bin/printf "***** <%= @_source -%> -> <%= @_target -%>\n"
/usr/bin/printf "***** Backup started %s\n\n" "$(date +"%F %T UTC")"
/usr/bin/time -p $RSYNC $RSYNC_OPTS <%= @_source -%> <%= @_target %>
/usr/bin/time -p $RSYNC "${RSYNC_OPTS[@]}" <%= @_source -%> <%= @_target %>
RSYNCEXIT=$?
if [ $RSYNCEXIT -ne 0 ]; then
echo "ERROR: rsync job (<%= @name -%>) process returned $RSYNCEXIT"