chiark / gitweb /
7c5fbe9a5b5fbae232070279c97912f816ec8cdf
[mirror-admin] / lib / functions.sh
1 ### -*-sh-*-
2 ###
3 ### Common functions for mirror scripts.
4
5 rsync_timeout=60
6
7 standard_rsync () {
8   for i in 1 2 3 4 5; do
9     set +e
10     rsync --recursive \
11       --verbose \
12       --timeout=$rsync_timeout \
13       --times --omit-dir-times \
14       --links --safe-links \
15       --delete-during --delete-excluded \
16       --chmod=ug=rw,o=r,Dg+s,Da+x --perms \
17       "$@"
18     rc=$?
19     set -e
20     case $rc in
21       30) ;;
22       *) return $rc ;;
23     esac
24     echo >&2 "rsync connection timed out: retrying"
25   done
26   return 30
27 }