42 lines
1.4 KiB
Bash
Executable File
42 lines
1.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
source /sync/scripts/backup_resources.sh
|
|
# FSFIXME expand_aliases still needed?
|
|
shopt -s expand_aliases # make aliases work
|
|
|
|
###############################
|
|
### update local backup dir ###
|
|
###############################
|
|
|
|
BACKUP_DIR=/sync/backup
|
|
ensureDirectory $BACKUP_DIR
|
|
BACKUP_DIR_HOME=$BACKUP_DIR/home
|
|
ensureDirectory $BACKUP_DIR_HOME
|
|
|
|
backupDirectory $HOME/.ssh/ $BACKUP_DIR_HOME/.ssh/
|
|
|
|
BACKUP_DIR_ROOT=$BACKUP_DIR/root/etc
|
|
ensureRootDirectory $BACKUP_DIR_ROOT
|
|
|
|
sd rsync_backup /etc/hosts $BACKUP_DIR_ROOT/
|
|
sd rsync_backup /etc/ddclient.conf $BACKUP_DIR_ROOT/
|
|
backupRootDirectory /etc/ddclient/ $BACKUP_DIR_ROOT/ddclient/
|
|
backupRootDirectory /etc/letsencrypt/ $BACKUP_DIR_ROOT/letsencrypt/
|
|
backupRootDirectory /etc/nginx/ $BACKUP_DIR_ROOT/nginx/
|
|
backupRootDirectory /etc/ssh/ $BACKUP_DIR_ROOT/ssh/
|
|
backupRootDirectory /etc/wireguard/ $BACKUP_DIR_ROOT/wireguard/
|
|
backupRootDirectory /etc/docker/daemon.json $BACKUP_DIR_ROOT/docker/
|
|
|
|
#####################
|
|
### upload backup ###
|
|
#####################
|
|
|
|
if [[ $# > 0 && "$1" == "--noupload" ]]; then
|
|
exit 0;
|
|
fi
|
|
|
|
sd rsync_backup -e "ssh -i /home/edi/.ssh/id_ed25519" --filter="P /home/docker" /sync/backup/ fabian@garrus:/citadel/backup/edi/
|
|
sd rsync_backup -e "ssh -i /home/edi/.ssh/id_ed25519" /home/edi/docker/ fabian@garrus:/citadel/backup/edi/home/docker/
|
|
echo "Note: remember to keep /citadel in sync!"
|