Rev 3410 Rev 3415
Line 18... Line 18...
18 BLUE="\033[01;36m" 18 BLUE="\033[01;36m"
19   19  
20 function info() { 20 function info() {
21 echo -en "$BLUE"; echo -n $1; echo -e "$DEFAULT" 21 echo -en "$BLUE"; echo -n $1; echo -e "$DEFAULT"
22 } 22 }
23   -  
24 function error() { 23 function error() {
25 echo -en "$RED"; echo -n $1; echo -e "$DEFAULT" 24 echo -en "$RED"; echo -n $1; echo -e "$DEFAULT"
26 } 25 }
27   26  
28 function syncdir() { 27 function syncdir() {
29 EXIT=1 28 EXIT=1
30 i=1 29 i=1
31 # while [ $EXIT -ne 0 ]; do 30 # while [ $EXIT -ne 0 ]; do
32 info "Trying to sync $1, try number $i" 31 info "Trying to sync $1, $2"
33 "$RSYNC" "$1" 32 "$RSYNC" $1 $2
34 EXIT=$? 33 EXIT=$?
35 [ $EXIT -ne 0 ] && error "sync failed" 34 [ $EXIT -ne 0 ] && error "sync failed"
36 let i++ 35 let i++
37 # done 36 # done
38 return $EXIT 37 return $EXIT
Line 100... Line 99...
100 # read last processed day 99 # read last processed day
101 OLD="$LAST" 100 OLD="$LAST"
102 read LAST < "$1"/LAST 101 read LAST < "$1"/LAST
103   102  
104 # sync last updated folders 103 # sync last updated folders
105 syncdir ./audio/"$LAST" 104 syncdir ./audio/"$LAST"
106 syncdir ./capture/"$LAST" 105 syncdir ./capture/"$LAST"
107 syncdir ./data/"$LAST" 106 syncdir ./data/"$LAST"
-   107 syncdir ./data --delete
108   108  
109 # days changed, sync yesterday too 109 # days changed, sync yesterday too
110 [[ "$LAST" != "$OLD" ]] && info "syncing yesterday" && syncdir "$OLD" 110 [[ "$LAST" != "$OLD" ]] && info "syncing yesterday" && syncdir "$OLD"
111   111  
112 tail -n 1000 "$1"/logfile.txt > "$1"/tmp.txt 112 tail -n 1000 "$1"/logfile.txt > "$1"/tmp.txt