Unanswered: How to automate FTP from Unix to Windows machine?
I need to automate (auto login) a FTP process from an unix server to a Windows machine. I need to check for the transfer status as well so that I can send a failure message to a designated unix user whenever they log on later? I would appreciate if you can show me some sample codes? Thanks.
# <<EOF allows for passing lots of commands
ftp ftp.sample.com <<EOF
# $? reads the exit code of the last program
if ! [ "$?" = "0" ]
then mail -s subject designated_unix_user <<EOF
Hi there, seems like the backup went wrong at $( date ).
the backup daemon
It is not perfect, I didn't test it as a whole. I especially couldn't pass the password this way for some reason, but I guess there are other ways to pass the credentials (f.i. with a ftp://username:password@host URL, check man ftp) if this doesn't work at your place either. Just play around a bit.