Dynamically add paths to inotify


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Dynamically add paths to inotify
# 1  
Old 01-13-2015
Dynamically add paths to inotify

I have initiated an inotify process with --fromfile option and the file contain the paths to be monitored.

Code:
/usr/local/maldetect/inotify/inotifywait -d -r -o /usr/local/maldetect/inotify/inotify_log --fromfile /usr/local/maldetect/sess/inotify.paths.28364 --exclude (^/var/tmp/mysql.sock) --timefmt %d %b %H:%M:%S --format %w%f %e %T -m -e create,move,modify

The file /usr/local/maldetect/sess/inotify.paths.28364 contain entries such as below.
Code:
/home/user1/public_html
/home/user2/public_html
/home/user3/public_html

There are almost 800 entries like this. What I need is, when a new user is created, the path /home/user4/public_html, should add the path dynamically to the existing inotify process without needing to re-initate the inotify process. As the initialization of inotify process is a bit resource hogging. Or anyway by which, if we add the path /home/user4/public_html to the file /usr/local/maldetect/sess/inotify.paths.28364, the inotify process will dynamically read it.
# 2  
Old 01-13-2015
Have you looked at the inotify_add_watch(2) man page?
This User Gave Thanks to Don Cragun For This Post:
# 3  
Old 01-13-2015
Thanks Don,

I am checking that only now.

---------- Post updated at 07:40 AM ---------- Previous update was at 07:28 AM ----------

It describes the usage of inotify_add_watch with a c program. I need to use with the compiled binary /usr/local/maldetect/inotify/inotifywait.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Tip: inotify cron

Dear members, moderators and others. While working on <insert project>, a need has surfaced to watch a directory, and when a file comes, to do appropriate action. So, i started writing some shell code, aware of linux inotify-tools package with inotifywait. Also, i'm seeing a lot of similar... (1 Reply)
Discussion started by: Peasant
1 Replies

2. Red Hat

Issues installing inotify-tools on RedHat Linux

I wish to install inotify-tools-3.20.1-2.4.x86_64.rpm on Linux and fire inotifywait command. Initially i was looking for "inotify-tools-3.xx.tar.gz" as instructed here http://jensd.be/248/linux/use-inotify-tools-on-centos-7-or-rhel-7-to-watch-files-and-directories-for-events I have... (9 Replies)
Discussion started by: mohtashims
9 Replies

3. Shell Programming and Scripting

Hotfolder with inotify-tools, loop FOR not working

I can not understand why this little script with a loop processes only one file. At boot in /etc/rc.local i wrote: /usr/local/bin/./myscript & This is myscript: #!/bin/bash while inotifywait -e create /HOTFOLDER/ ; do for fullname in /HOTFOLDER/*.xlsx; do if !... (22 Replies)
Discussion started by: pasaico
22 Replies

4. Shell Programming and Scripting

Add # dynamically to log file

Hello, I need help to add a # dynamically to a .txt file that contain files location I called the file listing.txt Dir1/Dir2/file_name Here is what I am trying to do. I am using a short shell ksh script on solaris. I am using a loop to read this log file line by... (3 Replies)
Discussion started by: Aswex
3 Replies

5. What is on Your Mind?

Possible Career Paths

I've read through a couple of forum posts on Career issues but wanted to get some feedback that may be more personalized and whatnot. I am brand new to the world of UNIX and Linux and while I am finding the learning curve rather steep, I find it highly rewarding and am overall enjoying the... (2 Replies)
Discussion started by: huntreilly25
2 Replies

6. SCO

inotify() in SCO UNIX

Hi I'm going to write a program in C language to watch activity on file system in SCO UNIX openserver 5.0.6. Apparently Linux provide an API called "inotify" , I'm wondering what's the SCO UNIX package for this ? (1 Reply)
Discussion started by: javad1_maroofi
1 Replies

7. Solaris

How to add new paths to $PATH

Hi all, I downloaded a tarball of coreutils .... extracted only to find out that i had to build it... But when i executed ./configure, this is what i got checking build system type... i386-pc-solaris2.11 checking host system type... i386-pc-solaris2.11 configure: autobuild project... GNU... (2 Replies)
Discussion started by: wrapster
2 Replies

8. UNIX for Advanced & Expert Users

Spoofing paths.

There is a program that I am trying to run on a shell account. It depends on another program, which I have also copied to the shell account. Both are in my home directory, yet the first program has a different path hardcoded into it, which I cannot use because of permissions problems. How can I... (3 Replies)
Discussion started by: fahadsadah
3 Replies

9. UNIX for Dummies Questions & Answers

paths

Hi there! People, i'm a new unix user, and i'm having some problems... I'm updating some scripts (korn shell) in different servers. I use telnet to access these servers and emacs to write the scripts. One of them is an HP, and there´s no problem. But the other one is an AIX, and when i call... (1 Reply)
Discussion started by: caiohn
1 Replies
Login or Register to Ask a Question