You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

Original ftp files

crontab entry

#30 0 * * * /users/viewmax/budget/ftp_csvfiles.sh >> /users/viewmax/backup/ftp.log 2>&1
ftp_csvfiles.sh
#!/usr/bin/ksh

/user/viewmax/budget/file_xfer.exp 
file_xfer.exp
exp_send "bi\r"
expect {
	ftp> {}
	timeout {ftp_err "Set binary mode"}
}


######################################
# Send daily backup and tracking files
######################################

exp_send "cd $remote_in\r"
expect {
	ftp> {}
	timeout {ftp_err "CD to remote in directory"}
}

exp_send "lcd $solaris_out\r"
expect {
	ftp> {}
	timeout {ftp_err "CD to in local directory"}
}


exp_send "put daily_backup.tgz mdcmptst_daily_backup.tgz\r"
expect {
	ftp> {}
	timeout {ftp_err "Send daily backup"}
}

exp_send "put tracking.csv mdcmptst_tracking.csv\r"
expect {
	ftp> {}
	timeout {ftp_err "Send tracking file"}
}

######################################
# Get department list updates
######################################

exp_send "cd $remote_out\r"
expect {
	ftp> {}
	timeout {ftp_err "Change diretory to get files"}
}

exp_send "get mdcmptst_accdept.csv\r"
expect {
	ftp> {}
	timeout {ftp_err "Get dept. account files."}
}

exp_send "get mdcmptst_psdept.csv\r"
expect {
	ftp> {}
	timeout {ftp_err "Get dept. PS files."}
}

exp_send "bye\r"

if {[file exists $vm_proj/accdept.csv]} {
	exec mv -f $vm_proj/accdept.csv $vm_proj/accdept.csv.last
}
exec cp -f $solaris_in/mdcmptst_accdept.csv $vm_proj/accdept.csv

if {[file exists $vm_proj/psdept.csv]} {
	exec mv -f $vm_proj/psdept.csv $vm_proj/psdept.csv.last
}
exec cp -f $solaris_in/mdcmptst_psdept.csv $vm_proj/psdept.csv

exit

  • No labels