Upload clocking script

谁说我不能喝 提交于 2020-01-15 11:45:06

问题


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

回答1:


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


来源:https://stackoverflow.com/questions/1495604/upload-clocking-script

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!