2 .
/opt
/corvix
/etc
/rbackup.conf
3 [[ -e $HOME/.rbackup.conf
]] && .
$HOME/.rbackup.conf
5 while getopts "l" opt
; do
7 l
) OPTS
="--bwlimit=66";;
17 RSYNC
="$NICE /usr/bin/rsync"
20 LOGFILE
=/opt
/corvix
/var
/log
/rbackup
21 RUNFILE
=/opt
/corvix
/var
/run
/rbackup
45 _log
"Rotate $name in $path on $host:"
46 $SSH $host "[[ -d $path ]] || mkdir -p $path"
47 if $SSH $host "[[ -d $path/$name.$interval ]]" ; then
48 _log
"Delete expired snapshot $interval on $host"
49 $SSH $host "$RM -rfv $path/$name.$interval" 2>&1 1>>$LOGFILE
51 for i
in $
(seq $
(($interval-1)) -1 0); do
52 $SSH $host "[[ -d $path/$name.$i ]]" ||
continue;
53 _log
"Rotate snapshot $i on $host"
54 $SSH $host "$MV -v $path/$name.$i $path/$name.\$(($i+1))" 2>&1 1>>$LOGFILE
63 _log
"Backup $name to $target on $host:"
64 $RSYNC -v -a --delete-excluded --exclude-from=$HOME/.rbackup.exclude
--delete $OPTS --link-dest=..
/$name.1 $source/ $host:$target/$name.0/ 2>&1 1>>$LOGFILE
69 hourly
) INTERVAL
=$HOURLY_INTERVAL;;
70 daily
) INTERVAL
=$DAILY_INTERVAL;;
71 weekly
) INTERVAL
=$WEEKLY_INTERVAL;;
72 monthly
) INTERVAL
=$MONTHLY_INTERVAL;;
76 _is_running
&& exit $ERUNNING
79 _rotate
$TASK $INTERVAL $TARGET/$SOURCE $HOST
80 _backup
$SOURCE $TASK $TARGET/$SOURCE $HOST