monitor directory events


 
Thread Tools Search this Thread
Operating Systems AIX monitor directory events
# 1  
Old 07-02-2009
monitor directory events

I'm am looking for a cheap way to trigger a script when a new file is written in a specific directory. AIX 5.3. It is a production system, so no kernel patching (i.e. inotify).
Filemon and audtiing are too expensive.
Thanks in advance.
# 2  
Old 07-02-2009
cronjob checks for the file, if it's there run a script

cronscript.sh:
Code:
if [ -f /yourfile ]
then
yourscript.sh
fi

crontab -e

Code:
* * * * * /cronscript.sh >/dev/null 2>&1

to look for new files in a directory::

something like

Code:
find /directory -cmin -1 -type f -exec /yourscript.sh {}\;

in your script use the $1 variable and do something with the file
Edit:

forgot to say, when using ctime, a file will be processed again when it's modified too, so you should move them elsewhere after first procesing

Last edited by funksen; 07-02-2009 at 05:03 AM..
# 3  
Old 07-02-2009
thanks but I was looking for something that traps the events instead of checking via cron
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk to monitor size in directory

i'm trying to find the most efficient way to monitor specific files in different directories in one go. /var/log/ /var/app/ /var/db/ each one of these directories can have subdirectories which need to be looked into as well. I want to find any file in this directory that has the name... (7 Replies)
Discussion started by: SkySmart
7 Replies

2. Shell Programming and Scripting

Directory Monitor in KSh

Hi, I need to write a directory monitor, i.e. a korn shell script which would Report changes to the directory contents, like: added file1, deleted file2, updated file3 , created subdir (optional)... There is no specific file pattern. So far I have written a little script... (1 Reply)
Discussion started by: olegkon
1 Replies

3. UNIX for Dummies Questions & Answers

Monitor directory and email

Hello all, Can anyone please guide / help me in the following task.... I have a directory where some external users will upload pdf files. The filename of these pdf will be of a particular format (<id>-<first name>_<last name>_<some number>.pdf) I want to make a script such that it takes... (6 Replies)
Discussion started by: dhawalkv
6 Replies

4. Shell Programming and Scripting

Monitor capacity of directory

Good morning. I have been attempting to find a way to monitor the capacity of a directory so that when it reaches 80% or higher I can send an event. I was able to find a script that does this for the whole drive by I can not seem to figure out how to do this for just a single directory. ... (1 Reply)
Discussion started by: LRoberts
1 Replies

5. HP-UX

Monitor file changed / created events on big FS

Hi all, The configuration: We are useing a HP-UX Server with vxfs File System. The files on this server have normally a umask of 022 (owned by a administrative account) users who have write access to certain files get custom ACL entries that add these rights for the specific user. Now a... (0 Replies)
Discussion started by: magics
0 Replies

6. Shell Programming and Scripting

script to monitor directory

What is the best way for a script to run to monitor a directory for the presence of files and then perform a function afterwords? I was hoping to have it continually run and sleep until it detects that files are present in the directory, then break out of the loop and go on to the next step. ... (17 Replies)
Discussion started by: nulinux
17 Replies

7. UNIX for Dummies Questions & Answers

Hep with script to monitor directory

Hello, I am a newbie who is attempting to write a script to monitor a directory for a set of 3 files that I am expecting to get ftp'd. Occasionally, we suspend operations for maintenance etc. but we still get the files so there can be more than 1 set. If there is more than 1 set, I would like... (2 Replies)
Discussion started by: cmf00186
2 Replies

8. Programming

Monitor which users enter my home directory

Hi, I would like to monitor which users enter my home directory. Is it possible to write a script or code to do this. I donot have admin privileges. I have given read permissions to access my home directory. Any pointers in this direction is helpful! Thanks, Pradeep Ps: I use the... (1 Reply)
Discussion started by: mnpradeep
1 Replies
Login or Register to Ask a Question