sync/scripts/backup_resources.sh

31 lines
422 B
Bash

#!/usr/bin/env bash
set -euo pipefail
source /sync/home_external/.bash_aliases
shopt -s expand_aliases # make aliases work
backupRootDirectory() {
ensureRootDirectory $2
sd rsync_backup $1 $2
}
backupDirectory() {
ensureDirectory $2
rsync_backup $1 $2
}
ensureRootDirectory() {
ensureDirectory $1
sudo chown root:root $1
}
ensureDirectory() {
if [[ ! -d $1 ]]; then
mkdir -p $1
fi
}