rsync a streaming file
Nathan Arnold d48407594c removed LICENSE, now using COPYING 5 years ago
COPYING renamed LICENSE to COPYING, heard this was the perferred name 5 years ago
README minor rewording of README 5 years ago Finished adding features for now. This should work but I haven't tested yet. 5 years ago


streamsync is designed to make it easy to copy a streaming (downloading) file from one machine to another before the download is complete.

The particular use case is that, while vlc can play a video file that isn't fully downloaded yet, I cannot find a file transfer program that works in the same way. This script utilises rsync's --inplace feature in order to repeatedly sync the streaming file between machines indefinitely.

Usage: streamsync [-t SLEEP] [-o OPTIONS] SOURCE DEST

The script creates a temporary hard link to SOURCE to perserve a consistent file name (some downloaders use temporary file names for incomplete files), and continues to sync that link to DEST until the link stops existing (or is interrupted). The link will be made in /tmp and contain SOURCE in its name so that it can be indentified easily. The proper way to terminate the script is with SIG_INT (ctrl-c). The script will clean-up the temporary link and exit successfully. Alternatively, the user can simply delete the link file to achieve the same effect.

OPTIONS is a quoted string containing any rsync options that the user would like to use. By default, "--inplace" and "-t" are enabled and should be considered required for this script to work.

DEST is the destination argument for rsync. I'm expecting this to be either the remote shell or local forms (see rysnc documentation). It is recommended to specify a target file name, otherwise the name of the temporary link will be used. The link name contains SOURCE (the source file name) to make it easy to indentify.

SOURCE is the source argument for rsync.

SLEEP is the number of seconds to wait between iterations, the default is 10.