Install the Globus CLI
The Globus CLI is available through the pip installer:
If you have administrator privileges type
The project is open source, so you can also download the source at https://github.com/globus/globus-cli
If you would like to use the CLI from Rivanna, please follow these directions below.
Authenticate using the Globus CLI
Log in against your institutional authentication provider. In the case of UVA, we use NetBadge for signing in:
This will open a page in your web browser where you select your institution and proceed to login:
Select “University of Virginia” and then click Continue. You are then taken to an authorization page where you agree to allow the Globus CLI to access your Globus account. Click on Allow.
You may now close your browser window. Your command-line tools are now authenticated and ready to use.
Issue the base command for the tools and you will see the primary set of commands:
For a full list of commands available:
List/Search Endpoints using the Globus CLI
Find a Globus endpoint. Here is how you might find the UVA Main DTN:
Or search more broadly for all UVA endpoints in Globus:
For transfers and file operations, reference endpoints by their unique ID. Names are only convenient tags to help humans differentiate between endpoints.
Traverse Directory Trees using the Globus CLI
Once you know the ID of a specific endpoint, you can list directories visible to you. Here are some paths open to users of the Rivanna HPC cluster:
To drill deeper, append directories to the endpoint ID with a colon
If we would like to transfer a file, we will need the full Globus ID and path of the source file:
Transfer Files using the Globus CLI
To transfer a file you will also need the ID and path to a destination directory and new filename – the place to which you would like to copy the remote file from above. It should look something like this:
With the full path to a source file and a full path to a destination, we can now request a transfer. The simplest form of a transfer request looks like this:
Note: If you wish to encrypt your transfer, add the –encrypt flag:
Get the Status of a Transfer
Using the Task ID returned from a request, you can get the status of a task:
Script Transfers Against the Globus CLI
Using the commands above, automated file transfers should not be difficult if run under a user account that has already authenticated. A simple bash script run via cron should work well for automated file shipments. Each shipment will trigger an automatic success/failure email, so there is no need to set up additional notifications.
Single file transfers
Transfer a single file at a time to another DTN, via script:
Folder sync transfers
Synchronize an entire folder and all contents with another DTN, via script:
Run your script:
Either operation should result in a confirmation message like this:
Automating your scripts
- In a Unix/Linux/MacOS environment, you can set any script or application to run on any schedule using cron.
- In Windows, we recommend writing the above into a PowerShell script, which can then be scheduled using the “Task Scheduler” tool from the Windows menu.
- See our main page introducing Globus Connect
- See the in-depth Globus CLI Documentation or Globus CLI Reference
- Globus also has an API and Python SDK.
- For other technical details, see Globus Documentation.
Use the Globus-CLI from your Rivanna Account
- Load the globus-cli module and its dependencies:
- Authorize globus-cli
Run this command:
You will then be given an Oauth2 login URL. Start a Web browser, either through FastX or through an X11 server on your local computer. Copy and paste this URL into the web browser, and authorize your connection as instructed in the topic above.
Be sure to give your authorization a useful name, such as
Return to the top of the page for information about using the Globus CLI generally.
When referencing the globus binary in scripts, you may want to issue a
which globus command to find its path as that may change over time with new versions. If used with backticks this can be used to populate a variable in a script:
Please note that users are not permitted to run cron jobs on Rivanna. Scheduling should be done from another system.