File Access Monitoring

From Indie IT Wiki
Revision as of 16:34, 22 March 2016 by imported>Indieit (→‎Custom Script)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

InCron

Install software...

sudo aptitude install -y -v incron

Allow normal users...

sudo nano /etc/incron.allow

Create a Incrontab to monitor a folder...

incrontab -e

Add the lines like this...

/home/user/Folder/ IN_MODIFY /usr/local/bin/incronotify "$#"

Save and exit the Incrontab editor.

Create the notification shell script of your choosing...

sudo touch /usr/local/bin/incronotify
sudo chmod +x /usr/local/bin/incronotify
sudo nano /usr/local/bin/incronotify

echo "$@" |mail -s "Change in folder" me@mydomain.com

Then test it!

http://www.cyberciti.biz/faq/linux-inotify-examples-to-replicate-directories/

https://www.howtoforge.com/triggering-commands-on-file-or-directory-changes-with-incron

http://inotify.aiken.cz/?section=incron&page=doc&lang=en

Custom Script

See this article.