jscp¶
A tool named jscp is provided with JetStream. It may be used to quickly transfer a file or folder between two locations which are running JetStream servers. The tool operates similar to scp.
jscp is part of the JetStream Python package, and is available on the command line when the Python package is installed. It is also the Python module jetstream.tools.jscp, and you can run the file jetstream/tools/jscp.py directly. The server packages install the Python package to /usr/local/share/jetstream/jetstream-python on Linux and to /usr/local/jetstream/share/jetstream-python on macOS.
Synopsis¶
jscp [options] source destination
Description¶
The jscp tool is intended to be used for sending and receiving files between two JetStream servers.
Options¶
- -p <source_api_port>, --serverPort <source_api_port>¶
Specifies the API port of the JetStream server that will send the copied files. This flag is optional. If not specified, a default of 8886 will be used.
- -P <destination_receive_port>, --destinationPort <destination_receive_port>¶
Specifies the destination port. This is the receiver port of the JetStream server that will receive the copied files. This flag is optional. If not specified, a default of 8886 will be used.
- -o <destination_api_port>, --destinationAPIPort <destination_api_port>¶
Specifies the API port of the JetStream server that will receive the copied files. This flag is optional. If not specified, a default of 8886 will be used.
- -r <maximum_send_rate>, --sendRateMax <maximum_send_rate>¶
Specifies the maximum send rate that should be used during the file copy. JetStream will automatically adjust the rate at which it sends data, but during this file copy will not allow it to exceed this rate. This flag is optional. If not specified, the maximum send rate is not restricted (but is still subject to server configuration limits and network conditions).
The maximum send rate is specified in kilobits per second.
- -s <source_send_port>, --senderPort <source_send_port>¶
Specifies the source port. This is the sender port of the JetStream server that will send the copied files. This flag is optional.
Note
This option is recorded but has no effect. The sender does not use a fixed port. The operating system gives it a port for each transfer. Do not write a firewall rule for the value that you give here.
- -d <destination_path>, --destinationPath <destination_path>¶
Specifies the path to use when writing these files at their destination. This path may be the same as the source, or you may choose a different path.
Note
Files at the destination will be written as described in Where Do Transfers Go?
For example, you can choose to write the destination at the same location as the source:
jscp /path/to/file.txt jetstream1:/path/to/file.txt
Or, you may “flatten” the directory structure from the source, and not use any on the destination.
jscp /path/to/file.txt jetstream1:file.txt
Or, you may choose to use the same name as the source, but specify a different parent folder.
jscp /path/to/file.txt jetstream1:/branch/documentation/file.txt
Or, you may choose something entirely different:
jscp /path/to/file.txt jetstream1:/something/completely/different.readme
- -q¶
Suppresses all console output. This may be useful when the command is run from a script, or in cases where the environment does not have TTY capabilities.
- -b¶
Writes progress line by line, with fields separated by tabs, and no progress bar. The first line is a header. This is useful when the command is run from a script.
- -v¶
Be more verbose when starting transfers
- -h, --help¶
Displays a usage summary, along with examples for how to specify the source and destination paths.
Source and Destination¶
The host from which the source file is copied is specified as part of the source path.
- Example:
jscp hostname:/path/to/source ...
The source host may be specified as a name or an IP:
- Example:
jscp repo:/path/to/source ... jscp 10.10.1.2:/path/to/source ...
If you are copying a file from your local workstation, you can omit the host. In this case, “localhost” will be assumed:
- Example:
jscp /path/to/source ...
The above is the same as:
- Example:
jscp localhost:/path/to/source ...
The host to which the file is copied is specified as part of the destination path. For example:
- Example:
jscp ... hostname:/path/to/destination
The destination host may be specified as a name or an IP:
- Example:
jscp ... jetstream1:/path/to/destination jscp ... 10.10.64.8:/path/to/destination
A JetStream server must be running on both the source and destination hosts.
jscp logs in to both servers. It uses your local user name, unless you give a user name before the host, as in user@host:/path. It asks for the password of each user.
- Example:
jscp jsmith@repo:/path/to/source jsmith@jetstream1:/path/to/destination
Examples¶
With a JetStream server running locally (on “localhost”) and on a remote host named “jetstream1”, copy the file from “/home/user/readme.txt” to the same path at the destination. The default send rate is used.
$ jscp /home/user/readme.txt jetstream1:/home/user/readme.txt
jscp shows one progress bar and updates it in place. The line shows the estimated time, the status, the send rates, the bytes copied, the total size and the percent complete.
Copy the directory “/project/manhattan/code” to a directory named “manhattan” at the destination. The send rate is limited to 10000 kilobits per second, and progress is written line by line.
$ jscp -b -r 10000 /project/manhattan/code jetstream1:manhattan
Status Effective Send Rate Reported Send Rate Completed Size Total Size Percent ETA
...