[英]linux or windows shell script to upload a file and copy it to another server
I am struggling with a problem. 我正在为一个问题而苦苦挣扎。 I have: 我有:
ServerA (is closer to me and much faster) ServerA(离我更近并且更快)
ServerB (is my website where I want the final file to stay) so what I want to do with the shell script (either Windows batch or linux, I have cygwin installed) is, passing the filename as parameter: ServerB(我希望保留最终文件的网站是我的网站),因此我要使用外壳程序脚本(无论是Windows批处理还是linux,我都安装了cygwin),将文件名作为参数传递:
1) upload with FTP a file to ServerA 1)使用FTP将文件上传到ServerA
2) login with ssh on serverB and wget the file from serverA 2)在serverB上使用ssh登录并从serverA中获取文件
I managed to do 1 with a shell script, but I don't understand how to do step2 in the shell? 我设法用shell脚本执行了1,但是我不明白如何在shell中执行step2?
Thanks 谢谢
I would recommend using scp
to accomplish step 2. You can use the syntax: 我建议使用scp
完成步骤2。您可以使用以下语法:
scp path/to/file serverb@hostname:/path/to/destination
. scp path/to/file serverb@hostname:/path/to/destination
。
You can read more about the syntax for scp
here: http://www.hypexr.org/linux_scp_help.php 您可以在此处阅读有关scp
语法的更多信息: http : //www.hypexr.org/linux_scp_help.php
您可以使用TeraTerm,它具有强大的脚本语言来自动化两个任务。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.