#!/bin/bash EXCLUDES="/tmp /var/tmp /proc /sys /selinux /media /dev/shm /mnt" OPTIONS="--exclude-device-files --print-statistics --force --ssh-no-compression" MAXAGE="1M" SRC="/" DST="server2.firma.pl::/backup-zdalny/server1" for i in $EXCLUDES; do OPTIONS="$OPTIONS --exclude $i" done rdiff-backup $OPTIONS $SRC $DST STATUS=$? msg="" if [ $STATUS -eq 0 ]; then msg="$msg Backup OK" rdiff-backup --force --remove-older-than $MAXAGE $DST if [ $? -eq 0 ]; then msg="$msg Cleaning OK" else msg="$msg Failed to remove older than $MAXAGE" fi else msg="$msg Failed to copy" fi echo $msg exit $STATUS