diff options
author | Carlo Landmeter <clandmeter@alpinelinux.org> | 2018-01-29 15:31:27 +0000 |
---|---|---|
committer | Carlo Landmeter <clandmeter@alpinelinux.org> | 2018-01-29 15:35:06 +0000 |
commit | 05f986658bc04e2dc514b2c3e7777007cb6fb65c (patch) | |
tree | db49882a6aac4ea68b7fa6285c340c09466abcc5 /profiles/backup-sync | |
download | alpine-backup-05f986658bc04e2dc514b2c3e7777007cb6fb65c.tar.bz2 alpine-backup-05f986658bc04e2dc514b2c3e7777007cb6fb65c.tar.xz |
Initial commit
Diffstat (limited to 'profiles/backup-sync')
-rwxr-xr-x | profiles/backup-sync | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/profiles/backup-sync b/profiles/backup-sync new file mode 100755 index 0000000..d4514ea --- /dev/null +++ b/profiles/backup-sync @@ -0,0 +1,19 @@ +#!/bin/sh + +echo "Sending backup to backup server" + +# make sure the destination directory exists +ssh "$BACKUP_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 "$BACKUP_LOCATION" | sed -n 2p) +if [ -n "$CURR_BACKUP" ]; then + HOSTNAME=$(hostname) + ssh "$BACKUP_SERVER" mv -f \ + $FQDN/week/$HOSTNAME.apkovl.tar.gz${SUFFIX} \ + $FQDN/week/$CURR_BACKUP +fi + +rsync -av --delete-after "$BACKUP_LOCATION/" \ + "$BACKUP_SERVER":"$FQDN"/week |