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:
To: xyz@m.facebook.com
From: myemail@mail.com
Subject: @twuser your download has completed
I then call that file with this command run from the same director as the test.mail file
Code:
cat test.mail | msmtp -a default xyz@m.facebook.com
I run two separate FTP commands, mget and mirror, dependng on which folder I am retrieving from. Let's say for folder "A" I run this.
Code:
lftp -u user,pass sftp://domain.com:port -e 'mirror -c --include-glob=*.ext "/path/to/destination/A/" "/path/to/local/dir/A/"'
For folder B I run this.
Code:
lftp -u user,pass sftp://domain.com:port -e 'mget -c -E /path/to/destination/B/*.ext -O "/path/to/local/dir/B/"'
Just to clarify, my email to twitter thing works perfectly, and my lftp downloading works perfectly, I just want to integrate the two.
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.