Tuesday, September 22, 2009

directory monitor dnotify

Yesterday a copier was installed in the company network. The machine could do a scan-to-FTP. So on the local debianbox I set up vsftpd. I wanted to change the permissions of each new scan that was made, so other users could use it as well. Instead of fiddling with the vsftpd config, I tested dnotify. It's a very small utility, very simple but very usefull. You can monitor a directory for changes, new files, deleted files, ... and add a command to execute upon one of these events.
For example: dnotify -b -C /share/scan -e chmod -R 0777 /share/scan
Everytime a new file is created in /share/scan it will set the permission.
-b tells it to run in background.