[K12OSN] Way OT: scripting help
Les Mikesell
les at futuresource.com
Wed May 23 15:36:01 UTC 2007
Dan Young wrote:
>> I've always thought rsync missed a feature by not having an option to
>> move files - that is, delete the source (only) after a successful
>> transfer. But, it is pretty reliable and a lot easier to script around
>> than other file transfer methods.
>
> rsync exits non-zero if the transfer is not successful. What's wrong with:
>
> rsync -avP -e ssh /foo root at dest:/foo && rm -f /foo
You have to run it per-file that way - and know the filename. I usually
do whole directory trees or wild-card filenames and would often like it
to be interruptible and pick up where it left off when you restart it.
For example, to gather web server logs from a farm of servers to one
place I use a wildcard filename in the rsync request, then after the run
completes I have to expand the filename list in the receiving directory
and ssh a command back to remove those files. This works, but only
because the names are date-stamped and unique. It would be a lot
cleaner if rsync had the option to do it as soon as it knows the
transfer is complete and successful.
--
Les Mikesell
lesmikesell at gmail.com
More information about the K12OSN
mailing list