FTP script

The auto script is including two parts.

1. Use crontab to modify and install the daily job
crontab -e
0 20 * * * /path/upload.sh
crontab: installing new crontab
crontab will run script at /path/upload.sh at 8PM everyday.

2. script upload.sh
This script is to batch upload *.csv file to xxx.xxx.xxx.xxx xxxx/serverdir

HOST='xxx.xxx.xxx.xxx xxxx'
USER='user1'
PASSWD='pass1'
FILE='*.csv'

ftp -n $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
cd serverdir
prompt
mput $FILE
quit
END_SCRIPT
exit 0

posted @ 2010-12-10 06:21  史莱姆  阅读(377)  评论(0编辑  收藏  举报