问题
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