上传时钟脚本 [英] Upload clocking script

查看:144
本文介绍了上传时钟脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何制作一个脚本,每天一次,通过ftp将文件上传到几个不同的服务器,然后记录(在日志中)上传花费了多少时间?


感谢Rajax我有cronjob设置执行这个脚本,让我们说它叫ftpScript.sh:

 #!/ bin / sh 

HOST ='ftp.users.qwest.net'
USER ='MYUSERNAME'
PASSWD ='MYPASSWORD'
FILE ='filename.gif'

ftp -n $ HOST<< END_SCRIPT
quote USER $ USER
quote PASS $ PASSWD
put $ FILE

quit
END_SCRIPT
exit 0

我在哪里放这部分?

  time -a output.log ftpScript.sh 


解决方案

您可以使用

使用命令行ftp上传文件。

文件和
时间命令来计算所需时间。



将时间输出添加到日志:

  time -a output.log ftpScript。 sh 


How can I make a script that, once a day, will upload a file via ftp to several different servers, then take note (in a log) of how much time the uploads took?

Thanks to Rajax I have the cronjob set up to execute this so far as the script, let's say it's called ftpScript.sh:

#!/bin/sh

HOST='ftp.users.qwest.net'
USER='MYUSERNAME'
PASSWD='MYPASSWORD'
FILE='filename.gif'

ftp -n $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
put $FILE

quit
END_SCRIPT
exit 0

Where do I put this part?

time -a output.log ftpScript.sh

解决方案

You can use cron to execute a script once a day.

Use command-line ftp to upload the files and the time command to time how long it took.

Appending time output to log:

time -a output.log ftpScript.sh

这篇关于上传时钟脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆