Sending email after successful lftp mget or mirror
Hey everyone, I've spent the last week configuring a server to auto download files from an FTP server the moment they are put up there, then delete them once I've downloaded them. I have been trying to send an email to a facebook email address once the process is completed, and from there the facebook will post to a twitter account but haven't had any luck. I've tested my mail scripts and it works flawlsessly, the second I send the mail script, I get a twitter notification on my phone saying download completed. This is my first experience with linux, so I'm not entirely sure how to do everything (that's why it took a week to setup so far :P)
I have my mail server setup like this with msmtp. I have a file named test.mail with the following contents Code:
Code:
cat test.mail | msmtp -a default xyz@m.facebook.com Code:
lftp -u user,pass sftp://domain.com:port -e 'mirror -c --include-glob=*.ext "/path/to/destination/A/" "/path/to/local/dir/A/"' Code:
lftp -u user,pass sftp://domain.com:port -e 'mget -c -E /path/to/destination/B/*.ext -O "/path/to/local/dir/B/"' I found this on superuser http://superuser.com/questions/64399...-ftp-transfer/ but I really have no idea how to implement it. Please do not think I am lazy and just leeching for answers, I have tried but have no idea where to go from here. Thank you. EDIT: It turns out twitter filters duplicate messages, so for example if I downloaded 4 files in a day it may only send me one message. I want to append a random string to the end of the subject, but $RANDOM doesn't work in msmtp evidently. |
Code:
./my_ftp_script.sh && echo "FTP was succesful" | sendmail you@yourdomain.com Code:
Cheers, and wish the best Josh Ninja edit - Wow, I didn't even notice a certain thing until of course after I have posted all of that. This will most likely get deleted... :/ (Reported username) |
All times are GMT -5. The time now is 08:21 AM. |