3 #==============================================================================
5 # File ID: e2b4cbf2-baff-11e8-97b6-c75b54f489f8
7 # Send files from $url to $dest with rsync, retry until it's done.
9 # Author: Øyvind A. Holm <sunny@sunbase.org>
10 # License: GNU General Public License version 2 or later.
11 #==============================================================================
23 while test -n "$1"; do
25 -a|
--append) opt_append
=1; shift ;;
26 -c|
--copy) opt_copy
=1; shift ;;
27 -h|
--help) opt_help
=1; shift ;;
28 -q|
--quiet) opt_quiet
=$
(($opt_quiet + 1)); shift ;;
29 -v|
--verbose) opt_verbose
=$
(($opt_verbose + 1)); shift ;;
30 --version) echo $progname $VERSION; exit 0 ;;
33 if printf '%s\n' "$1" |
grep -q ^
-; then
34 echo "$progname: $1: Unknown option" >&2
42 opt_verbose
=$
(($opt_verbose - $opt_quiet))
44 if test "$opt_help" = "1"; then
45 test $opt_verbose -gt 0 && { echo; echo $progname $VERSION; }
48 Usage: $progname [options] [ -- rsync_options ]
53 Don't check downloaded data, only append data to the end of files.
56 Don't use the --inplace option with rsync, write to a copy of the
57 destination file before overwriting it.
61 Be more quiet. Can be repeated to increase silence.
63 Increase level of verbosity. Can be repeated.
65 Print version information.
67 Create the rcfile and define url (ssh address of source directory) and
68 dest (local directory). For example:
70 url=user@fromhost:/home/user/tel/
77 cmd_rsync
="rsync -rmvLPzz --timeout=15"
80 test -e "$rcfile" && .
"$rcfile"
82 if test -z "$url" -o -z "$dest"; then
83 echo $progname: url or dest not defined
in $rcfile >&2
87 if test "$opt_append" = "1"; then
92 if test "$opt_copy" = "1"; then
97 ps |
grep -v "grep $cmd_rsync" |
grep "$cmd_rsync" && exit 1
98 until $cmd_rsync $append_str $copy_str $url $dest "$@"; do
103 # vim: set ts=8 sw=8 sts=8 noet fo+=w tw=79 fenc=UTF-8 :