0

I'm trying to run inotifywait as daemon by this command:

root@server:/# inotifywait -mrd -e delete -e delete_self -e create -e moved_from -e moved_to /path -o /tmp/path.log

But I'm getting this error:

inotifywait: invalid option -- 'd'

What am I doing wrong?

Martin
  • 111
  • 4
  • Crosspost: http://unix.stackexchange.com/questions/191757/inotifywait-invalid-option-d-daemon – peterh Mar 22 '15 at 11:06
  • Don't cross-post with unix SE, it is evil! After your question was (unfairly) closed there, or you didn't get useful answers, is it ok to re-post. But only after that. – peterh Mar 22 '15 at 11:07
  • Your command works for me on CentOS 6.6. You neither specify the ionotifywait version nor OS version you are using. So it's not really possible to answer, could be an too old version. – faker Mar 22 '15 at 12:03
  • @peterh what should I do now? – Martin Mar 22 '15 at 13:01
  • @faker how can I get OS & its version please? – Martin Mar 22 '15 at 13:01
  • @Martin Let it as is, it is not so serious thing. – peterh Mar 22 '15 at 13:17
  • @faker `cat /proc/version` `Linux version 3.8.0-31-generic (buildd@panlong) (gcc version 4.7.3 (Ubuntu/Linaro 4.7.3-1ubuntu1) ) #46-Ubuntu SMP Tue Sep 10 20:03:44 UTC 2013` – Martin Mar 22 '15 at 14:06
  • 1
    I'm voting to close this question as off-topic because a) it's cross-posted to Unix/Linux, and b) the poster appears to not be conversant with reasonable business information technology management practices. – Jenny D Mar 22 '15 at 16:01
  • @JennyD Ok close it. But what do you mean by "not be conversant with reasonable business information technology management practices" ?? – Martin Mar 22 '15 at 16:24
  • The comment "How can I get OS & its version" indicates a lack of prerequisite knowledge to manage a unix system according to those practices. – Jenny D Mar 22 '15 at 19:21
  • @JennyD sorry, I thought this is Q&A site – Martin Mar 22 '15 at 21:45
  • @Martin It is a QA site, but not all Qs are suitable for this particular site. You were right to post on Unix/Linux; it doesn't have the same audience as this one and your question would be on-topic there. – Jenny D Mar 23 '15 at 04:49

1 Answers1

1

There was a problem with inotifywait version. While v3.14 has -d and -o parameters, older version 3.13 hasn't.

This can solve that:

#!/bin/bash
inotifywait -qmr -e modify,delete,delete_self,create,moved_from,moved_to /path |
while read line; do
        echo $line >> /tmp/watch.log
done

And runs with & at the end of command.

Martin
  • 111
  • 4