aboutsummaryrefslogblamecommitdiff
path: root/modules/role/templates/backup/backup_head.sh.erb
blob: be9f5bf41ed74ca41f402ece772880e2956d05e3 (plain) (tree)



















                                                                                
#!/bin/bash
MAILTO="<%= @mailto %>"

EXCL_FROM=`mktemp`
FILES_FROM=`mktemp`
TMP_STDERR=`mktemp`

on_exit() {
  if [ -s "$TMP_STDERR" ]; then
    cat "$TMP_STDERR" | mail -Ssendwait -s "save_distant rsync error" "$MAILTO" 
  fi
  rm -f $TMP_STDERR $EXCL_FROM $FILES_FROM
}

trap "on_exit" EXIT

exec 2> "$TMP_STDERR"
exec < /dev/null

set -e