#!/bin/sh echo "Sending backup to backup server" # make sure the destination directory exists ssh "$RBU_SERVER" mkdir -p $FQDN/week # get the name of the renamed backup and also rename # this backup on the remote to prevent dulpicate upload CURR_BACKUP=$(ls -t "$RBU_LOCATION" | sed -n 2p) if [ -n "$CURR_BACKUP" ]; then ssh "$RBU_SERVER" mv -f \ $FQDN/week/$(hostname).apkovl.tar.gz${SUFFIX} \ $FQDN/week/$CURR_BACKUP fi rsync -av --delete-after "$RBU_LOCATION/" \ "$RBU_SERVER":"$FQDN"/week