Skip to content

Instantly share code, notes, and snippets.

@leipzig
Created May 14, 2013 16:55
Show Gist options
  • Save leipzig/5577536 to your computer and use it in GitHub Desktop.
Save leipzig/5577536 to your computer and use it in GitHub Desktop.
Expect script for Aspera uploads for use when the server chokes on wildcards
#!/usr/bin/expect -f
#Upload a file to an Aspera server, filling in the passphrase field
#Usage: ./autopass.sh mybigassfile
set arg1 [lindex $argv 0]
set timeout -1
spawn ascp -i sra-rsakey-putty.ppk -k 1 -Qr -l300M $arg1 user@asperadomain.ncbi.nlm.nih.gov:protected/
expect "Passphrase for key \"rsa-key-blahblah\":"
send "mypassword\r"
expect "Completed"
#add the file you successfully uploaded to a log
set filelog [open uploadedfiles.txt a]
puts $filelog $arg1
@leipzig
Copy link
Author

leipzig commented May 15, 2013

This is best paired with a "screen" session, so as to prevent a local disconnection from killing the job (like nohup but more easily revisited):

screen -dR dbgap
for f in sra/files/*; do ./autopass.sh $f; done

ctrl-a then d to leave the screen and go about your business

screen -dR dbgap to revisit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment