views:

31

answers:

1

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  A: 

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
rajax
Can the output of the time command be redirected to a file?
James Black
Yes, added to answer
rajax
Thanks James, I was going to ask the same question!
pg