4 echo usage: $0 configfile
9 echo configfile $1 is not a file
15 host=`grep ^host $config | cut -d ' ' -f 2`
16 user=`grep ^user $config | cut -d ' ' -f 2`
17 homedirs="` grep ^homedirs $config | cut -d ' ' -f 2-`"
18 extradirs="`grep ^extradirs $config | cut -d ' ' -f 2-`"
19 replicas=`grep ^replicas $config | cut -d ' ' -f 2`
20 oldest=`grep ^oldest $config | cut -d ' ' -f 2`
21 data=`grep ^data $config | cut -d ' ' -f 2`
22 bandwidth=`grep ^bandwidth $config | cut -d ' ' -f 2`
24 ping -c1 $host > /dev/null 2>&1
27 if [ "$ret" = "0" ]; then
28 echo "host $host is online ..."
30 echo "host $host unreachable ..."
34 if [ ! -d $data ]; then
35 echo "no data directory ..."
40 backupdir=$data/${user}_at_${host}
45 rsync="rsync -azR --delete --bwlimit=$bandwidth"
48 for pb in $backupdir/[0-9]*; do
50 if [ ! -f $backupdir/.$bdd ]; then
51 if [ "$pb" != "$cbd" ]; then
57 for dir in $homedirs; do
58 rsrc="$rsrc :/home/$user/$dir"
60 rsrc="`echo $rsrc | sed 's/^\ //'`"
61 for dir in $extradirs; do
64 $rsync $user@$host$rsrc $cbd
66 [ "$ret" != "0" ] && exit -50
72 cob=`echo $ob | wc -w`
73 if [ $cob -gt $replicas ]; then
74 ((numdel=cob-replicas))
75 todel="`echo $ob | cut -d ' ' -f 1-${numdel}`"
76 echo "to delete: $todel"
77 #for dirdel in $todel; do
78 # bdd=`basename $dirdel`