diff options
| author | Marc Vertes <mvertes@free.fr> | 2020-06-24 14:29:51 +0200 |
|---|---|---|
| committer | Marc Vertes <mvertes@free.fr> | 2020-06-24 14:29:51 +0200 |
| commit | ad7f45231cb867990a03830ec09e0cd41959f539 (patch) | |
| tree | dea3b4efb580e4ccfd71506e86c000e1c83652bc /bin/backup | |
| parent | f0bd81aa4e40511825e7d818d267f18a86df2c47 (diff) | |
update
Diffstat (limited to 'bin/backup')
| -rwxr-xr-x | bin/backup | 14 |
1 files changed, 6 insertions, 8 deletions
@@ -3,23 +3,21 @@ [ "$USER" = root ] || exec sudo "$0" "$@" -while getopts :Fv opt; do +while getopts :v opt; do case $opt in - (F|v) eval "opt$opt=$opt" ;; - (*) echo "Usage: $0 [-Fv] [[host:]dir]"; exit 1 ;; + (v) eval "opt$opt=$opt" ;; + (*) echo "Usage: $0 [-v] [[host:]dir]"; exit 1 ;; esac done shift $((OPTIND - 1)) dest=${1:-/.history} date=$(date +%Y%m%d_%H%M%S) -last=$(rsync --list-only $dest/ 2>/dev/null | cut -b 47- | tail -1) +last=$(rsync --list-only "$dest/" 2>/dev/null | cut -b 47- | tail -1) case $last in -(2*) opt_link=--link-dest=../$last;; +([12]*) opt_link=--link-dest=../$last;; (*) opt_link=;; esac -[ "$optF" ] && fsfreeze -f / && trap 'fsfreeze -u /' EXIT - -rsync -HSxa$optv --exclude-from=/etc/backup/ignore $opt_link / /boot $dest/$date +rsync -HSxa$optv --exclude-from=/etc/backup/ignore $opt_link / /boot "$dest/$date" |
