iNotify doesn't appear to be working in my DS1819+

Currently reading
iNotify doesn't appear to be working in my DS1819+

I'm running an Emby server from my NAS, and the real-time monitoring of my media libraries isn't working; it doesn't pick up when I add or remove files and I have to manually run a scan from the Emby app.


It doesn't appear to be an Emby-specific issue, as iNotify doesn't seem to notice that I've made the changes and therefore Emby is never alerted. Someone on the Emby forum had me run inotifywait -rm on the folder my media is stored in, and when I add or remove files while I can see some changes to the output, there's nothing specific to a file. Just lots of opening and closing folders.
 
If permission is the issue, then either become root before executing the snippet (sudo -i) or become any user that is allowed to access the folder before running it.

One more thing: If your inotify watches would be exhausted, you see an error message about it when running the snippet.
 
Upvote 0
Right, but the administrators group has full permissions relating to the folder. So permissions should be fine.

It runs as root, though, yes.

Code:
New file 'CLOSE_NOWRITE,CLOSE,ISDIR' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'OPEN,ISDIR' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'CLOSE_NOWRITE,CLOSE,ISDIR' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'OPEN,ISDIR' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'OPEN,ISDIR' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'CLOSE_NOWRITE,CLOSE,ISDIR' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'OPEN,ISDIR' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'CLOSE_NOWRITE,CLOSE,ISDIR' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'CLOSE_NOWRITE,CLOSE,ISDIR' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'OPEN,ISDIR' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'CLOSE_NOWRITE,CLOSE,ISDIR' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'OPEN,ISDIR' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'OPEN,ISDIR' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'CLOSE_NOWRITE,CLOSE,ISDIR' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'OPEN,ISDIR' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'CLOSE_NOWRITE,CLOSE,ISDIR' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'CLOSE_NOWRITE,CLOSE,ISDIR' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'OPEN,ISDIR Postman Always Rings Twice, The (1946)' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'OPEN,ISDIR Postman Always Rings Twice, The (1946)' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'CLOSE_NOWRITE,CLOSE,ISDIR Postman Always Rings Twice, The (1946)' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'OPEN,ISDIR Postman Always Rings Twice, The (1946)' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'ACCESS,ISDIR Postman Always Rings Twice, The (1946)' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'CLOSE_NOWRITE,CLOSE,ISDIR Postman Always Rings Twice, The (1946)' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'CLOSE_NOWRITE,CLOSE,ISDIR Postman Always Rings Twice, The (1946)' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'OPEN,ISDIR Postman Always Rings Twice, The (1946)' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'CLOSE_NOWRITE,CLOSE,ISDIR Postman Always Rings Twice, The (1946)' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'OPEN,ISDIR Postman Always Rings Twice, The (1946)' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'OPEN,ISDIR Postman Always Rings Twice, The (1946)' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'ACCESS,ISDIR Postman Always Rings Twice, The (1946)' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'ACCESS,ISDIR Postman Always Rings Twice, The (1946)' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'CLOSE_NOWRITE,CLOSE,ISDIR Postman Always Rings Twice, The (1946)' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'OPEN,ISDIR Postman Always Rings Twice, The (1946)' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'CLOSE_NOWRITE,CLOSE,ISDIR Postman Always Rings Twice, The (1946)' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'OPEN,ISDIR Postman Always Rings Twice, The (1946)' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'CLOSE_NOWRITE,CLOSE,ISDIR Postman Always Rings Twice, The (1946)' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'CLOSE_NOWRITE,CLOSE,ISDIR Postman Always Rings Twice, The (1946)' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'OPEN,ISDIR Postman Always Rings Twice, The (1946)' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'OPEN,ISDIR Postman Always Rings Twice, The (1946)' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'CLOSE_NOWRITE,CLOSE,ISDIR Postman Always Rings Twice, The (1946)' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'OPEN,ISDIR Postman Always Rings Twice, The (1946)' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'ACCESS,ISDIR Postman Always Rings Twice, The (1946)' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'ACCESS,ISDIR Postman Always Rings Twice, The (1946)' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'CLOSE_NOWRITE,CLOSE,ISDIR Postman Always Rings Twice, The (1946)' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'OPEN,ISDIR Postman Always Rings Twice, The (1946)' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'CLOSE_NOWRITE,CLOSE,ISDIR Postman Always Rings Twice, The (1946)' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'OPEN,ISDIR Postman Always Rings Twice, The (1946)' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'CLOSE_NOWRITE,CLOSE,ISDIR Postman Always Rings Twice, The (1946)' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'OPEN,ISDIR Postman Always Rings Twice, The (1946)' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'CLOSE_NOWRITE,CLOSE,ISDIR Postman Always Rings Twice, The (1946)' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'OPEN,ISDIR Postman Always Rings Twice, The (1946)' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
New file 'CLOSE_NOWRITE,CLOSE,ISDIR Postman Always Rings Twice, The (1946)' in directory '/volume1/Emby' via action: 'Libraries/Stubs/'
 
Upvote 0
Nah, my snippet was wrong. I missed to quote the use of "${source}"

Code:
source="/volume3/docker/test/Test with space"
inotifywait -m "${source}" |
    while read path action file; do
        echo "New file '$file' in directory '$path' via action: '$action'"
    done

the space characters break the "while read" tokiziation and the value for $action always becomes 'with':
Setting up watches.
Watches established.
New file 'space/ OPEN,ISDIR' in directory '/volume3/docker/test/Test' via action: 'with'
New file 'space/ CLOSE_NOWRITE,CLOSE,ISDIR' in directory '/volume3/docker/test/Test' via action: 'with'
New file 'space/ CREATE docker_info.txt' in directory '/volume3/docker/test/Test' via action: 'with'
New file 'space/ OPEN docker_info.txt' in directory '/volume3/docker/test/Test' via action: 'with'
New file 'space/ ATTRIB docker_info.txt' in directory '/volume3/docker/test/Test' via action: 'with'
New file 'space/ ATTRIB docker_info.txt' in directory '/volume3/docker/test/Test' via action: 'with'
New file 'space/ MODIFY docker_info.txt' in directory '/volume3/docker/test/Test' via action: 'with'
New file 'space/ ATTRIB docker_info.txt' in directory '/volume3/docker/test/Test' via action: 'with'
New file 'space/ CLOSE_WRITE,CLOSE docker_info.txt' in directory '/volume3/docker/test/Test' via action: 'with'
New file 'space/ OPEN,ISDIR' in directory '/volume3/docker/test/Test' via action: 'with'
New file 'space/ CLOSE_NOWRITE,CLOSE,ISDIR' in directory '/volume3/docker/test/Test' via action: 'with'

If I print the whole line, instead of tokenizing it, everything looks fine:

Code:
source="/volume3/docker/test/Test with space"
inotifywait -m "${source}"
results in:
Setting up watches.
Watches established.
/volume3/docker/test/Test with space/ OPEN,ISDIR
/volume3/docker/test/Test with space/ CLOSE_NOWRITE,CLOSE,ISDIR
/volume3/docker/test/Test with space/ CREATE docker_info.txt
/volume3/docker/test/Test with space/ OPEN docker_info.txt
/volume3/docker/test/Test with space/ ATTRIB docker_info.txt
/volume3/docker/test/Test with space/ ATTRIB docker_info.txt
/volume3/docker/test/Test with space/ MODIFY docker_info.txt
/volume3/docker/test/Test with space/ ATTRIB docker_info.txt
/volume3/docker/test/Test with space/ CLOSE_WRITE,CLOSE docker_info.txt

Maybe Emby made the same "tokenization error" I did in my previous example....


sidenote: media folders including space are recognized properly in Plex...
 
Upvote 0
That explains why it kept not finding the folder before, which I fixed by running this instead:
Code:
inotifywait -m "/volume1/Emby Libraries/Stubs/" |
    while read path action file; do
        echo "New file '$file' in directory '$path' via action: '$action'"
    done

So no, it's nothing to do with the quotes around "source".
 
Upvote 0
What? If the script I ran doesn't use the variable, the way it treats variables won't change anything.

I ran this:
Code:
inotifywait -m "/volume1/Emby Libraries/Stubs/" |
    while read path action file; do
        echo "New file '$file' in directory '$path' via action: '$action'"
    done

How could that possibly be affected by ${source}? It can't, because it doesn't have ${source} anywhere in it.
 
Upvote 0
You still don't understand my objective, do you?

I agree, it is irrelevant wether you use a variable or string beeing quited for the -m parameter, though quoting the parameter is relevant.

This is the party breaker, caused by space characters in paths.
the space characters break the "while read" tokiziation and the value for $action always becomes 'with':
while read treats spaces as a delimiter and reads parts of the path into different variables.

This is why the 2nd approach does not use "while read".

It is unlikely, but not impossible that Emby has the same problem when parsing the path of an event. I would investigate further if it works with space free folder names and raise an issue to the Emby developers it works.

Good luck!
 
Upvote 0
You still don't understand my objective, do you?

I agree, it is irrelevant wether you use a variable or string beeing quited for the -m parameter, though quoting the parameter is relevant.
But there is no difference between
Code:
source="/volume1/Emby Libraries/Stubs/"
inotifywait -m "${source}"

and
Code:
inotifywait -m "/volume1/Emby Libraries/Stubs"

They're identical.

As evidenced by the fact that having tried it your way just now, I'm still getting "Libraries/Stubs" listed as the action. It changed nothing.
-- post merged: --

Any chance of moving passed this by renaming the shared folder ... Emby_Libraries ?

BTW @crusher11 you didn't say if this has ever worked or if has just stopped working.
I'm 99.99999% sure it used to work. Renaming the share means having to completely re-do the entire media server, which is...not ideal.
 
Upvote 0

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

Similar threads

I think I'm trying to ask how is the Drive desktop agent 'safe'. I know how VPN works and why to use it. I...
Replies
8
Views
1,317
There is no problem seeing photo thumbnails. There is a issue to see thumbnails in android browser dialog...
Replies
3
Views
781

Welcome to SynoForum.com!

SynoForum.com is an unofficial Synology forum for NAS owners and enthusiasts.

Registration is free, easy and fast!

Back
Top