moneyslow.com

ftp或sftp的自动shell脚本

ftp命令

ftp命令

ftp:

#!/usr/bin/ksh
ftp -n -i<<EOF 2>&1
open <target server ip>
user <username> <pwd>
lcd /sc/doc/prd/FCSTP
put file1.txt
quit
EOF

sftp:

#!/usr/bin/ksh
HOST='<target ip address>'
user='<username>'
pass='<pwd>'
echo "Starting to sftp..."
sftp $HOST<<EOF 2>&1
user $user
$pass
lcd /sc/doc/tst/FCSTP
put file1.txt
bye
EOF
echo "done"
Exit mobile version