golforeo.blogg.se

File monitor linux
File monitor linux








The makeIncrontab.sh script takes as an argument the name of the user from the user's monitored home directory (culled from the variable included in each of root's incrontab rules) and removes the existing incrontab file for that user from the /var/spool/incron/ directory. Each line monitors the users' home directories and calls the makeIncrontab.sh script ( Listing 2) whenever a subdirectory is created in any of the monitored directories. The rules in root's incrontab will look something like this: /home/joe IN_CREATE /usr/local/bin/makeIncrontab.sh IN_CREATE /usr/local/bin/makeIncrontab.sh IN_CREATE /usr/local/bin/makeIncrontab.sh you do have to create one rule per editor, but unless you're continually hiring and firing editorial staff, you won't have to change this file very often. To accomplish this, you use a global, superuser incrontab with one line per editor to write in each file. Thus, user joe's incrontab will be /var/spool/incron/joe, user jane's file will be /var/spool/incron/jane, and so on. The inrontab files live at /var/spool/incron/, and each user has their own with their name on it. The trick is to get your script to write directly into the users' incrontab files without having to use incrontab -e. If you monitor the users' top-level directories, incron won't see when a file is added to an issue subdirectory, so it seems you will have to create an incrontab line for each new subdirectory you create in a user's home folder, and that seems as bothersome as emailing each editor by hand – unless you write a script to do it for you. This sets another challenge: As mentioned before, incron does not implement recursivity, so you can't just monitor the top level and bore down when a folder for a new issue is created. Instead of dumping all the documents willy-nilly into one directory, you want to be able to monitor each of the users' home directories on the server and then monitor the subdirectories that are created for each magazine and issue within those directories. You could hope that your staff will check their online folders regularly, but you can't afford to assume that will happen. Instead of copying the documents to the server, firing up your email client, and manually shooting off a message to the concerned party, you just want to copy the document and be done with it.

file monitor linux file monitor linux

For example, imagine you're the editor in chief of a famous Linux magazine, and you need to tell your editors when articles are available for editing, correcting, proofreading, and so on. Something else you can do is use incron to tell users when they have new documents on a server waiting to be processed.










File monitor linux