Search Results

Search found 50 results on 2 pages for 'inotify'.

Page 1/2 | 1 2  | Next Page >

  • How can I tell if I am out of inotify watches?

    - by Jorge Castro
    I use an application that consumes inotify watches. I've already set fs.inotify.max_user_watches=32768 in /etc/sysctl.conf but last night the application stopped indexing unless I ran it manually, which leads me to suspect I am out of watches. Since I don't know what the trade off is when I increase this number (does it consume more RAM?), I don't know if I should just increase this number, so I'd like to know if there's a way I can tell if it's using all these watches and what the tradeoffs might be for increasing it.

    Read the article

  • Alternatives to auditd and inotify for monitoring file deletion

    - by Tola Odejayi
    I'm trying to figure out which processes are deleting files from a specific directory on my CentOS server. I looked at inotify, but all this does is to tell me how many file deletions are occurring; it does not tell me what process run by which user did the deletions, nor does it tell me when they happened. I also tried auditd, but I have had no luck in getting it set up on my server. Does anyone have any other tool they can suggest that will do this?

    Read the article

  • Using inotify-tools and ruby to push uploads to Cloud Files

    - by Christian
    Hi Guys, I wrote a few scripts to monitor an uploads directory for changes, then capture the file uploaded/changed and push it to cloud files using a ruby script. This all works well 95% of the time, the only exception is that occasionally, ruby fails with a 'file does not exist' exception. I am assuming that the ruby 'push' script is being called before the file is 100% in its new location, so the script is being called a little prematurely. I tried adding a little function to my script to check if the file exists, if it doesn't, sleep 5 then try again, but this seems to snowball and eventually dies. I then just added a sleep 2 to all calls, but it hasn't helped as I now get the 'file does not exist' error again. #!/bin/sh function checkExists { if [ ! -e "$1" ] then sleep 5 checkExists $1 fi } inotifywait -mr --timefmt '%d/%m/%y-%H:%M' --format '%T %w %f' -e modify,moved_to,create,delete /home/skylines/html/forums/uploads | while read date dir file; do cloudpath=${dir:20}${file} localpath=${dir}${file} #checkExists $localpath sleep 2 ruby /home/cbiggins/bin/pushToCloud.rb skylinesaustralia.com $cloudpath $localpath echo "${date} ruby /home/cbiggins/bin/pushToCloud.rb skylinesaustralia.com $cloudpath $localpath" >> /var/log/pushToCloud.log done I am looking for any suggestions to help me make this 100% stable (eventually, I'll serve the uploaded files from Cloud FIles, so I need to make sure its perfect) Thanks in advance!

    Read the article

  • C program using inotify to monitor multiple directories along with sub-directories?

    - by lakshmipathi
    I have program which monitors a directory (/test) and notify me. I want to improve this to monitor another directory (say /opt). And also how to monitor it's subdirectories , current i'll get notified if any changes made to files under /test . but i'm not getting any inotifcation if changes made sub-directory of /test, that is touch /test/sub-dir/files.txt .. Here my current code - hope this will help /* Simple example for inotify in Linux. inotify has 3 main functions. inotify_init1 to initialize inotify_add_watch to add monitor then inotify_??_watch to rm monitor.you the what to replace with ??. yes third one is inotify_rm_watch() */ #include <sys/inotify.h> int main(){ int fd,wd,wd1,i=0,len=0; char pathname[100],buf[1024]; struct inotify_event *event; fd=inotify_init1(IN_NONBLOCK); /* watch /test directory for any activity and report it back to me */ wd=inotify_add_watch(fd,"/test",IN_ALL_EVENTS); while(1){ //read 1024 bytes of events from fd into buf i=0; len=read(fd,buf,1024); while(i<len){ event=(struct inotify_event *) &buf[i]; /* check for changes */ if(event->mask & IN_OPEN) printf("%s :was opened\n",event->name); if(event->mask & IN_MODIFY) printf("%s : modified\n",event->name); if(event->mask & IN_ATTRIB) printf("%s :meta data changed\n",event->name); if(event->mask & IN_ACCESS) printf("%s :was read\n",event->name); if(event->mask & IN_CLOSE_WRITE) printf("%s :file opened for writing was closed\n",event->name); if(event->mask & IN_CLOSE_NOWRITE) printf("%s :file opened not for writing was closed\n",event->name); if(event->mask & IN_DELETE_SELF) printf("%s :deleted\n",event->name); if(event->mask & IN_DELETE) printf("%s :deleted\n",event->name); /* update index to start of next event */ i+=sizeof(struct inotify_event)+event->len; } } }

    Read the article

  • PHP Inotify Non-blocking way

    - by demic0de
    I am reading a file in linux which is a log file that keeps on updating weather the file has changed and output it to the webpage. i do it using php inotify but my problem is that it is blocking. How can i make php inotify non-blocking so i can do other stuff while it is monitoring the text file?. <?php $fd = inotify_init(); $watch_descriptor = inotify_add_watch($fd, '/tmp/temp.txt', IN_MODIFY); touch('/tmp/temp.txt'); $events = inotify_read($fd); $contents = file_get_contents('/tmp/temp.txt'); echo $contents; inotify_rm_watch($fd, $watch_descriptor); fclose($fd) ?> Or can i do this in java?..Thanks.

    Read the article

  • Watch Filesystem in Real Time on OS X and Ubuntu

    - by Adrian Schneider
    I'm looking for a CLI tool which will watch a directory and spit out the names of files that change in real time. some_watch_command /path/to/some/folder | xargs some_callback I'm aware of inotify (inotify-tools?) and it seems to be what I need, but I need something that is both Linux (in my case Ubuntu) and OSX compatible. It doesn't need to be lightning fast, but it does need to trigger upon changes (within a second is reasonable). Also, I don't necessarily need the exact CLI program mentioned above. If some underlying tech exists and is easily scriptable on both platforms that would be great too.

    Read the article

  • Perl Linux::Inotify2 - can't respond to events anymore

    - by alcy
    I am getting some really weird behavior when using Linux::Inotify2 module for watching a directory for any newly created files. I had made a test script to see how it worked, and once that was done, I went on to incorporating its usage in the other scripts, in which it didn't work. Then, when I tried my earlier test script again to find some information, strangely that stopped working as well. It hasn't worked since then. There were no package/distro upgrades during that time. The problem is that it has stopped responding to events. Here's the test script: #!/usr/bin/perl use strict; use warnings; use Linux::Inotify2; my $inotify = new Linux::Inotify2 or die "unable to create new inotify object: $!"; my $dir = "/my/dir"; $inotify->watch($dir, IN_CREATE, sub { my $e = shift; print $e->fullname; }) or die " Can't watch $!"; 1 while $inotify->poll; A strace on the running script kills the script. Otherwise when strace is used when starting the script, then it does seem to read the new events, but there's no response to those events. Any suggestions for debugging this further ?

    Read the article

  • Process Name with inotify tool

    - by Priyanka
    Hi ALl Is there a way to find out which process is causing a particular event to occur? In the inotify-tool version 3.13, in struct_kernel , pid,uid and gid are used but it is not handled in the source code. Is there any latest patch available for the same. Please let me know.

    Read the article

  • Can any linux API or tool watch for any change in any folder below e.g. /SharedRoot or do I have to

    - by Simon B.
    I have a folder with ~10 000 subfolders. Can any linux API or tool watch for any change in any folder below e.g. /SharedRoot or do I have to setup inotify for each folder? (i.e. I loose if I want to do this for 10k+ folders). I guess yes, since I've already seen examples of this inefficient method, for instance http://twistedmatrix.com/trac/browser/trunk/twisted/internet/inotify.py?rev=28866#L345 My problem: I need to keep folders time-sorted with most recently active "project" up top. When a file changes, each folder above that file should update its last-modified timestamp to match the file. Delays are ok. Opening a file (typically MS Excel) and closing again, its file date can jump up and then down again. For this reason I need to wait until after a file is closed, then queue the folder of that file for checking, and only a while later do I go and look for the newest file in its folder, since the filedate of the triggering file could already be back-dated to its original timestamp by Excel or similar programs. Also in case several files from same folder are used/created, it makes sense to buffer timestamping of that folders' parents to at least get a bunch of updates collapsed into one delayed update. I'm looking for a linux solution. I have some code that can be run on a windows server, most of the queing functionality is here: http://github.com/sesam/FolderdateFollowsFiles/blob/master/FolderdateFollowsFiles/Follower.vb Available API:s The relative of inotify on windows, ReadDirectoryChangesW, can watch a folder and its whole subtree; see bWatchSubtree on http://msdn.microsoft.com/en-us/library/aa365465(VS.85).aspx Samba? Patching samba source is a possibility, but perhaps there are already hooks available? Other possibilities, like client side (various windows versions) and spying on file activities in order to update folders recursively?

    Read the article

  • Get notified about the change in raw data in hard disk sector - File change notification

    - by Nuv
    I'm trying to make a software that backups my entire hard drive. I've managed to write a code for reading the raw data from hard disk sectors. However, i want to have incremental backups. For that i need to know the changed made to OS settings, file changes, everything. My question is - Using FileSystemWatcher and Inotify, will i be able to know every change made to every sector in the hard drive ? (OS settings etc) I'm coding it in C++ for linux and windows. (Saw this question on Stackoverflow which gave me some idea)

    Read the article

  • Use inotifywait and lftp to synchronize servers

    - by KBoek
    I have two servers: Server A (CentOS), where people can upload files to (upload root is /files) Server B (Win 2008), with FileZilla FTP Server (FTP root is C:\content) I want that whenever a file is uploaded to Server A, to any subfolder under /files, the file is automatically copied to the exact same subfolder on Server B. Thus, if a user uploads "flowers.jpg" to /files/photos/12345/ then the file must be copied over FTP to C:\content\photos\12345 So far I have this bash script, it does copy the files to server B, but all files are placed in C:\content, and not in the corresponding subfolders. Who can help me find the correct syntax? #!/bin/bash cd /files inotifywait -q -r -m -e close_write,moved_to . --format %w%f | while read FILE; do lftp -e "put $FILE; exit" -u user,password -p 2121 ftp.server-a.com done

    Read the article

  • inotifywait usage and exclude

    - by user58542
    I want to monitor special path to any event of create or modified files recursively in it via inotifywait but i cant know what's problem. i have some folder that i want to exclude thame. watchpath -> folder1 -> file1 -> ingnorefile1 [IG] -> ignorefolder1 [IG] i have problem to exclude them. inotifywait -mr --exclude '(ignorefolder1|folder1\/ingnorefile1)' -e modify -e create -e delete . | while read date time dir file; do what is correct regular expression ?

    Read the article

  • implement INotifyCollectionChanged etc on xml file changed

    - by netmajor
    It's possible to implement INotifyCollectionChanged or other interface like IObservable to enable to bind filtered data from xml file on this file changed ? I see examples with properties or collection, but what with files changes ? I have that code to filter and bind xml data to list box: XmlDocument channelsDoc = new XmlDocument(); channelsDoc.Load("RssChannels.xml"); XmlNodeList channelsList = channelsDoc.GetElementsByTagName("channel"); this.RssChannelsListBox.DataContext = channelsList;

    Read the article

  • something like INotifyCollectionChanged fires on xml file changed

    - by netmajor
    It's possible to implement INotifyCollectionChanged or other interface like IObservable to enable to bind filtered data from xml file on this file changed ? I see examples with properties or collection, but what with files changes ? I have that code to filter and bind xml data to list box: XmlDocument channelsDoc = new XmlDocument(); channelsDoc.Load("RssChannels.xml"); XmlNodeList channelsList = channelsDoc.GetElementsByTagName("channel"); this.RssChannelsListBox.DataContext = channelsList;

    Read the article

  • Inotifywait doesn't run command

    - by Marius Miliunas
    I have a basic inotifywait script called watch.sh and a few files ending in .styl in the same directory. Here's the script, that catches the changes, but doesn't execute the code within the do/done I init it like sh watch.sh and here's the script #!/bin/sh while inotifywait -m -o ./log.txt -e modify ./*.styl; do stylus -c %f done I tried having echo "hi" within the exec portion but nothing executes

    Read the article

  • explain notifier.c from the Linux kernel

    - by apollon
    I'm seeking to fully understand the following code snippet from kernel/notifier.c. I have read and built simple link lists and think I get the construct from K&R's C programming. The second line below which begins with the 'int' appears to be two items together which is unclear. The first is the (*notifier_call) which I believe has independent but related significance with the second containing a 'notifier block' term. Can you explain how it works in detail? I understand that there is a function pointer and multiple subscribers possible. But I lack the way to tie these facts together, and could use a primer or key so I exactly understand how the code works. The third line looks to contain the linking structure, or recursive nature. Forgive my terms, and correct them as fit as I am a new student of computer science terminology. struct notifier_block { int (*notifier_call)(struct notifier_block *, unsigned long, void *); struct notifier_block *next; int priority; };

    Read the article

1 2  | Next Page >