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?

| improve this question | | | | |
  • 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 - Reinstate Monica 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
  • 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
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.

| improve this answer | | | | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.