Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a script running on my box that checks every 5 minutes to see if a certain time type was uploaded to a folder on my Ftp server. I would like for it to send an email when the transfer is successful. I've tried to set something up with postfix, but I can't find a way to put in an if statement to the ftp script, so I'm at a roadblock.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Assuming you have something like sendmail correctly configured, you don't even need to have the mail command in your script. Just do something like

./my_ftp_script.sh && echo "FTP was succesful" | sendmail you@yourdomain.com

Just make sure your script exits with a non 0 value on failure.

share|improve this answer
    
Thank you so much, I've got it now. –  hey Sep 15 '13 at 3:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.