So, using incron, I set it up by running
sudo apt-get install incron.
My goal: Allow emails with picture attachments sent to an alias (sendtodropbox.com app) to be automatically copied into my blog's photo repository for posting.
Next I created a simple bash script:
ls photo.JPG | while read a; do mv $a "$(echo "$a" | sed s/photo.JPG/"photo$(date +%a%b%d%H%M).jpg"/)"; done
mv photo* ~/Dropbox/Attachments /<photo repo>/
I place the script in
~/, then edit the
/etc/incron.allow file to include my user name because these scripts and files are all in my home dir. Next I have to edit the incron config file by running
In here I used
~/Dropbox/Attachments/ IN_MOVED_TO ~/script.sh (I used IN_MOVED_TO because the action of Dropbox placing a file in the Dropbox folder is considered a move)
This is working instantaneously when I email my Dropbox a picture from my phone now. I also tested incron with both root and my user name to make sure it worked, my first test as my user was:
incrontab -e add the config:
~/ IN_CREATE touch ~/test, I then go to
~/, and run