Watchfolders - Part 1

1 minute read

Using inotify tools to watch folders for new files

I have a requirement to have many external systems push files to our internal systems as well as have internal systems push files out. While this can be done in many different ways, I didn’t really feel comfortable having an external system punched right through the firewall directly to a production system.

The idea of creating a very slim machine with limited services and access came to mind as a staging area for the files that external systems need to push or get started to develop into a very real implementation. The benefit for implementing this other system was that services like webDAV, ftp, FTPs, sftp and such did not have to be added to, or configured for each internal system. The internal systems have access to a shared storage area, so as long as they can see the file, no other service has to be configured on the production system and can be offloaded to the external facing system.

The external facing server really only has one role, to be an interface between external systems and internal systems. It is much easier to secure as single role system than a full blown production system. Even though the interface system has multiple interface services, it still only has one role, to get and send files.

When initially designing the process, it became evident that the files coming from external sources would come in at irregular intervals. A cron task could be created to process the file ever X minutes, but this seems like a bit of useless processing. Using INOTIFY tools, the files could be processed as soon as the external server put the files in the directory. This process overview is what I am attempting to accomplish.

WatchFolder Overview

» Watchfolders Part 2