Skip to content

Instantly share code, notes, and snippets.

@Magneticdud
Created February 16, 2017 10:57
Show Gist options
  • Save Magneticdud/0be7f11b25c73eb3800b11ee5add9a89 to your computer and use it in GitHub Desktop.
Save Magneticdud/0be7f11b25c73eb3800b11ee5add9a89 to your computer and use it in GitHub Desktop.
Automagically send new files via email
inotifywait -m /files/ -e create -e moved_to |
while read path action file; do
echo "The file '$file' appeared in directory '$path' via '$action'"
echo "waiting 30s"
sleep 30s
# do something with the file
sendEmail -o tls=yes -f [email protected] -t [email protected] -s smtp.email.it:587 -xu [email protected] -xp mypassword -u "Scansione" -m "Invio scansione" -a /files/$file
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment