Rev 3407 Rev 3410
Line 6... Line 6...
6 exec > >(tee "$1"/logfile.txt) 6 exec > >(tee "$1"/logfile.txt)
7   7  
8 # Also redirect stderr 8 # Also redirect stderr
9 exec 2>&1 9 exec 2>&1
10   10  
11 FREQUENCY=60 11 FREQUENCY=180
12   12  
13 TIDYUP="$(pwd)/tidyup.sh" 13 TIDYUP="$(pwd)/tidyup.sh"
14 RSYNC="$(pwd)/upload.sh" 14 RSYNC="$(pwd)/upload.sh"
15   15  
16 DEFAULT="\033[00m" 16 DEFAULT="\033[00m"
Line 26... Line 26...
26 } 26 }
27   27  
28 function syncdir() { 28 function syncdir() {
29 EXIT=1 29 EXIT=1
30 i=1 30 i=1
31 while [ $EXIT -ne 0 ]; do 31 # while [ $EXIT -ne 0 ]; do
32 info "Trying to sync $1, try number $i" 32 info "Trying to sync $1, try number $i"
33 "$RSYNC" "$1" 33 "$RSYNC" "$1"
34 EXIT=$? 34 EXIT=$?
35 [ $EXIT -ne 0 ] && error "sync failed" 35 [ $EXIT -ne 0 ] && error "sync failed"
36 let i++ 36 let i++
37 done 37 # done
38 return $EXIT 38 return $EXIT
39 } 39 }
40   40  
41 # Sort files 41 # Sort files
42 # Mask 42 # Mask
Line 66... Line 66...
66 sshtest || exit 1 66 sshtest || exit 1
67   67  
68 # Change working directory 68 # Change working directory
69 cd $1 69 cd $1
70   70  
-   71  
71 # reset counter 72 # reset counter
72 HOURCOUNT=24 73 HOURCOUNT=24
73   74  
74 # Periodically tidy up and do incremental sync 75 # Periodically tidy up and do incremental sync
75 while : 76 while :
Line 114... Line 115...
114 115
115 # end timer 116 # end timer
116 end_time=`date +%s` 117 end_time=`date +%s`
117 ELAPSED=`expr $end_time - $start_time` 118 ELAPSED=`expr $end_time - $start_time`
118 info "execution time was $ELAPSED s" 119 info "execution time was $ELAPSED s"
-   120
-   121 date
119   122
120 # if last sync took less than TIME, sleep to make up 1 hour 123 # if last sync took less than TIME, sleep to make up 1 hour
121 [[ $ELAPSED -lt $FREQUENCY ]] && sleep `expr $FREQUENCY - $ELAPSED` 124 # [[ $ELAPSED -lt $FREQUENCY ]] && sleep `expr $FREQUENCY - $ELAPSED`
-   125 sleep $FREQUENCY
122 done 126 done
123 127