blob: 4ef83bee7064f0c36e486a9c76541ca1547fba07 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#!/bin/sh
# Incremental backup using rsync(1).
[ "$USER" = root ] || exec sudo "$0" "$@"
while getopts :v opt; do
case $opt in
(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)
case $last in
([12]*) opt_link=--link-dest=../$last;;
(*) opt_link=;;
esac
rsync -HSxa$optv --exclude-from=/etc/backup/ignore $opt_link / /boot "$dest/$date"
|