blob: cc98d63f3e5b2960ba2951848e9ef6bbd38fa311 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#!/bin/sh
# incremental backup using rsync(1)
die() { echo "$0: fatal: $@" >&2; exit 1; }
[ "$(id -u)" = 0 ] || die must run as root
while getopts :v opt; do
case $opt in
(v) optv=v ;;
(*) echo "Usage: $0 [-v] [[host:]dir]"; exit 1 ;;
esac
done
shift $((OPTIND - 1))
#dest=${1:-/backup/$(hostname)}
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
(2*) opt_link=--link-dest=../$last;;
(*) opt_link=;;
esac
rsync -DSHxa$optv --exclude-from=/etc/backup/ignore $opt_link / /boot $dest/$date
|