~johnsca/charms/trusty/ibm-java/layer-review

« back to all changes in this revision

Viewing changes to files/sftp_get.sh

  • Committer: Prabakaran Chandrasekaran
  • Date: 2016-02-15 08:55:57 UTC
  • Revision ID: prabacha@in.ibm.com-20160215085557-flrpm410rrf2ibof
Intial commit of ibm-java layer charm source code

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/expect
 
2
# Helper script to connect and download using sftp
 
3
# Invoked from download action
 
4
# Usage: sftp_get.sh user password host remote_dir localpath
 
5
 
 
6
set user [lindex $argv 0]
 
7
set password [lindex $argv 1]
 
8
set host [lindex $argv 2]
 
9
set r_dir [lindex $argv 3]
 
10
set localpath [lindex $argv 4]
 
11
 
 
12
set timeout 90
 
13
spawn sftp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $user@$host
 
14
expect "password:"
 
15
send "$password\n"
 
16
expect "sftp>"
 
17
set timeout 3000
 
18
send "get -r $r_dir $localpath\n"
 
19
expect "sftp>"
 
20
send "exit\n"