I am running inotifywait (inotify-tools-3.14-1) in the daemon mode, however, it gave the following error and no watches are established. Also, since it is within the while loop, there were many inotifywait daemon processes created.
I have no such problem if running with --monitor instead of --daemon. Can someone help fixing it? Thanks a lot.
"Couldn't initialize inotify. Are you running Linux 2.6.13 or later, and was the CONFIG_INOTIFY option enabled when your kernel was compiled? If so, something mysterious has gone wrong. Please e-mail radu.voicilas@gmail.com and mention that you saw this message."
Below is the code:
while true # run indefinitely
do
inotifywait --daemon --outfile /tmp/daemon.log --event close_write --format '%w%f %e %T' --timefmt '%F %T' $folder | while read eventInfo
do
call_another_fun $eventInfo
break
done
done
When there are too many inotify processes running in background, I also get this "Couldn't initialize inotify..." error message.
A pkill inotify
solved this.