File tree Expand file tree Collapse file tree 4 files changed +42
-15
lines changed
Expand file tree Collapse file tree 4 files changed +42
-15
lines changed Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ set -eu
3+
4+ SCRIPT_DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " & > /dev/null && pwd ) "
5+ REPO_DIR=" $( dirname " ${SCRIPT_DIR} " ) "
6+ TIMESTAMP=" $( date +%Y-%m-%d_%H-%M-%S) "
7+ LOG_PATH=" ${REPO_DIR} /logs/rsync_backup_${TIMESTAMP} .txt"
8+ HOSTNAME=" $( hostname) "
9+ HOSTNAME_TRIMMED=" ${HOSTNAME% " -kubuntu" } "
10+
11+ if [ " $# " -ne 1 ]; then
12+ echo " Usage: ${0} <home|root>"
13+ exit 1
14+ elif [ " ${1} " == " home" ]; then
15+ rsync \
16+ --archive --compress --delete --partial --progress --stats \
17+ --exclude-from=" ${SCRIPT_DIR} /rsync_exclude_home.txt" \
18+ " ${HOME} " \
19+ " ${USER} @agx-file-backup:/mnt/backup/${HOSTNAME_TRIMMED} /rsync/" | & tee -a " ${LOG_PATH} "
20+ elif [ " ${1} " == " root" ]; then
21+ rsync \
22+ --archive --delete --partial --progress --stats \
23+ --exclude-from=" ${SCRIPT_DIR} /rsync_exclude_root.txt" \
24+ / \
25+ " /mnt/h12-backup-3tb/rsync/" | & tee -a " ${LOG_PATH} "
26+ else
27+ echo " Usage: ${0} <home|root>"
28+ exit 1
29+ fi
File renamed without changes.
Original file line number Diff line number Diff line change 1+ bin
2+ dev
3+ lib
4+ lib32
5+ lib64
6+ libx32
7+ lost+found
8+ media
9+ mnt
10+ proc
11+ sbin
12+ sys
13+ tmp
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments