Post Reply 
Feature Request: Re-Scan/inotify
24-04-2012, 19:14
Post: #8
RE: Feature Request: Re-Scan/inotify
(24-04-2012 17:55)KoS Wrote:  
Quote:A simple solution would be to add a new MinimWatch command "sleep <n>" to sleep for <n> seconds. You could include this in the echo string to provide the necessary delay. Would this be suitable?
i thought also about that, but somehow i don't know how to combine the two so that i works like it should:

Code:
sleep 5; echo 'restart' | java -jar /opt/minimserver/lib/minimwatch.jar
the sleep here delays the whole execution/start of minimwatch and not only the echo command :-(

You would do the following:
Code:
echo -e "sleep 5\nrestart\nsleep 10\nexit" | java -jar /opt/minimserver/lib/minimwatch.jar

MinimWatch will start and process the "sleep 5" command immediately. It will wait 5 seconds (while MinimServer is discovered), then it will process the "restart" command. It will wait 10 seconds (while MinimServer restarts), then it will process the "exit" command. You can adjust the two sleep times based on how long things take in your setup.

I've written some prototype code to test this, and it works very well. Smile

Quote:if there are multiple minimserver on the network, will then always the local one be choosen as the first? so that the restart command restart the local one?

No, the selection of a MinimServer instance will be random, based on which MinimServer instance responds first to the M-SEARCH discovery message. So this approach doesn't work if you'll be running multiple MinimServer instances.

It would be possible to extend MinimWatch to allow it to select a specific MinimServer instance (based on the displayName). With this, you'd need to use a command string like:
Code:
echo -e "sleep 5\nselect server1\nrestart\nsleep 10\nexit" | java -jar /opt/minimserver/lib/minimwatch.jar

Quote:or would it be possible to make it like for other unix daemons where a SIGHUP signal to the minimserver would force it to reload, or rescan, the media library?

There's a problem with this, because some NAS versions of Linux send a SIGHUP to MinimServer on exit from the shell that started MinimServer (even if MinimServer was started as a background process). To prevent this SIGHUP from ending the MinimServer process, I've added a --nohup option to MinimServer that makes it ignore SIGHUP. This is equivalent to using the nohup program to launch MinimServer.

I presume that a Linux daemon that uses SIGHUP to reload its configuration would also reload its configuration when the shell that started the daemon exits. This doesn't seem ideal. How do these Linux daemons handle this?

Quote:i think i can live with it if it's possible to force the rescan by a script. so i can write an inotify-script that then forces the rescan.

OK, that makes sense.

Quote:i'll add some bug reports & feature requests as separate threads, i hope thats fine?

thanks for your help!

Please go ahead and do that. It's definitely a good idea to use a separate thread for each topic.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread

Forum Jump:


User(s) browsing this thread: 2 Guest(s)