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