Post Reply 
 
Thread Rating:
  • 4 Votes - 3.75 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Auto Rescan package for Synology users (formerly known as Auto Restart package)
06-01-2013, 13:00 (This post was last modified: 26-04-2016 18:29 by winxi.)
Post: #1
Auto Rescan package for Synology users (formerly known as Auto Restart package)
The MinimServer Auto Rescan package is an unofficial extension to MinimServer. It uses inotify-tools to monitor the MinimServer content directories and automatically initiates a MinimServer rescan when a file system event has been detected in the MinimServer content directory(ies). MinimServer 0.8.4 or higher and inotify-tools are required. You can download the package from the attachment at the bottom of this post.

Installation
You can install this package by choosing 'Manual Install' in the Synology package center. The package requires MinimServer 0.8.4 or above and inotify-tools to be installed. You can install inotify-tools for example from this repository: http://synology.francis-besset.com/
The Auto Rescan package works with all Synology DS models supported by MinimServer, as long as inotify-tools is available.

Usage
You can conveniently uninstall, upgrade, start or stop the package and view the log file using the Synology package center.

Mode of operation
When starting the package, it extracts the name(s) of the MinimServer content directory(ies) from the MinimServer config file and establishes watches for this(ese) directory(ies). This process may take a while and is finished when "Watches established." appears in the package log file. Please note that the log doesn't refresh automatically when you view it in the Synology package center. To update it you have to close and reopen the log window.
As soon as inotify detects a file system event in the watched directories, a 10 seconds timer will be started. If inotify detects no other event during the timer interval, a MinimServer rescan will be initiated. If another event has been detected during the timer interval, the timer will be reset and run another 10 seconds.

Notes/limitations
  • The Auto Rescan package requires the MinimServer package 0.8.4 or above to be installed at your Synology DS.
  • When the Auto Rescan package automatically initiates a MinimServer rescan, it happens the same as if you would do it manually. This means that MinimServer will not be visible to control points during the rescan phase but you should be able to continue playing the current playlist.
  • When you change the MinimServer content directory(ies) (the MinimServer contentDir property), you have to restart MinimServer manually and also have to restart the Auto Rescan package manually using the Synology package center. The latter step is required because the Auto Rescan package does determine the MinimServer content directories only on startup.


Changelog
  • v1.1, 26.04.2016
    - the maximum amount of inotify watches per user is set to 102400 if the current value is lower
    - hidden files (beginning with a dot) are excluded from the watches
    - improved logging
  • v1.0, 24.04.2016
    - the package name changed from Auto Restart to Auto Rescan.
    - the package now uses command scripting (introduced in MinimServer 0.8.4) for communication with MinimServer instead of the deprecated named pipe.
    - the package does not use a daemon user anymore.
    - the installer does not attempt to download and compile inotify-tools anymore.
    - the possibility to configure the package in the not very user-friendly config file has been removed in favor of some hard-coded, reasonable default values.
    - the size of the log file is now limited to 500kB.
  • v0.9, 31.08.2014
    - added a more robust check for the user home service being enabled.
  • v0.8, 11.03.2014
    - compatibility changes for DSM 5.0 and MinimServer 0.8.1b. This version requires MinimServer 0.8.1b or later.
  • v0.7, 24.01.2014
    - fixed a broken bootstrap link for the 88f6282 architecture
  • v0.6, 17.12.2013
    - updated the package to be compatible with MinimServer version 0.8.1 or higher
  • v0.5, 13.08.2013
    - fixed a problem where the MinimServer status could not be retrieved when using MinimServer in combination with the Synology Java Manager
    - fixed a bug related to loading the default settings
  • v0.4, 15.06.2013
    - new default settings: restartBehaviour (forceRestart), firstTimeout (2), restartTimeout (10)
    - the package now enables the 'User home service' automatically if required
    - improved logging
  • v0.3, 06.03.2013
    - fixed incompatibility issue with DSM 4.2
    - removed dependency on the MinimServer package
  • v0.2e, 09.02.2013
    - added support for cedarview architecture
  • v0.2d, 28.01.2013
    - added support for Synology 2013 PPC models
  • v0.2b, 16.01.2013
    - added a dependency on the MiniMServer package with a version number of 0.63.3 or above
  • v0.2, 12.01.2013
    - the package now uses the dedicated daemon user 'minimautorestart'
    - added configuration properties
    - changed the Minimserver status and inotify events retrieving method
    - properly handle content directories containing spaces
    - improved logging
  • v0.1b, 08.01.2013
    - fixed the status retrieving method to be more robust
    - improved logging during installation
  • v0.1, 06.01.2013
    - initial release


DISCLAIMER: This package is provided 'as is' and doesn’t include any kind of warranty.


Attached File(s)
.spk  AutoRescan-1.1.spk (Size: 50 KB / Downloads: 66)
Find all posts by this user
Quote this message in a reply
06-01-2013, 13:38
Post: #2
RE: Auto Restart package for Synology users
Hi winxi,
Thanks very much for creating this package and making it available!

Simon
Find all posts by this user
Quote this message in a reply
06-01-2013, 17:41
Post: #3
RE: Auto Restart package for Synology users
Many thanks for this as well as for your main Synology package!

David
Find all posts by this user
Quote this message in a reply
06-01-2013, 21:34 (This post was last modified: 06-01-2013 21:44 by alegend.)
Post: #4
RE: Auto Restart package for Synology users
First of all I gotta say a big THANK YOU for this tool!
Thats what Ive been waiting for :-9

But....
problems:
When a new file gets added (e.g. via a download from SABNZB)nothing happens.
The log tells me
Couldn't watch new directory /volume1/Music/testfile
and then
Permission denied /volume1/Music/testfile

What could be the reason for this?
I gave foll permissions READ / Write to that dir.
Any clue?

When I copy a file from on dir to another
everthing seems ok and the log tells me that it reconigzed the file copy but then also nothing changes in the dir and the file doesnt show up...
log says "AWAITING 20 seconds to restart" but nothing happens (i see it on minimwatch - it doenst get restartet...)
Find all posts by this user
Quote this message in a reply
06-01-2013, 22:16
Post: #5
RE: Auto Restart package for Synology users
(06-01-2013 21:34)alegend Wrote:  First of all I gotta say a big THANK YOU for this tool!
Thats what Ive been waiting for :-9

But....
problems:
When a new file gets added (e.g. via a download from SABNZB)nothing happens.
The log tells me
Couldn't watch new directory /volume1/Music/testfile
and then
Permission denied /volume1/Music/testfile

What could be the reason for this?
I gave foll permissions READ / Write to that dir.
Any clue?

Hi,

inotifywait is executed by the minimserver daemon user. So you have to make sure that the daemon user has read access to all your content directories and files. Please check the permissions for files newly added by SABnzbd.

Quote:When I copy a file from on dir to another
everthing seems ok and the log tells me that it reconigzed the file copy but then also nothing changes in the dir and the file doesnt show up...
log says "AWAITING 20 seconds to restart" but nothing happens (i see it on minimwatch - it doenst get restartet...)

How did you check the log file? Please note that when you view the log-file via the Synology package center, the view isn't updated automatically. You have to close the log window and then reopen it again to refresh it. I can't think of a reason for the Auto Restart package to hang after the 'Awaiting 20 seconds timeout to restart...' message now.

In any case it would be helpful if you could post the complete restart.log file as an attachment here. You will find it in /homes/minimserver/autorestart.

Best regards,
winxi
Find all posts by this user
Quote this message in a reply
06-01-2013, 23:23 (This post was last modified: 06-01-2013 23:25 by alegend.)
Post: #6
RE: Auto Restart package for Synology users
Quote:Hi,

inotifywait is executed by the minimserver daemon user. So you have to make sure that the daemon user has read access to all your content directories and files. Please check the permissions for files newly added by SABnzbd.

Sab moves files to a public available music dir with full access for the minimserver user. So i dont understand why it says permission denied....


Quote:How did you check the log file? Please note that when you view the log-file via the Synology package center, the view isn't updated automatically. You have to close the log window and then reopen it again to refresh it. I can't think of a reason for the Auto Restart package to hang after the 'Awaiting 20 seconds timeout to restart...' message now.

In any case it would be helpful if you could post the complete restart.log file as an attachment here. You will find it in /homes/minimserver/autorestart.
I recognized that I have to refresh the dir. but i know it hasnt been restartet because my UPNP client (bubble upnp on android) doesnt show the new files.


when i copy a mp3 file into another dir the restart log shows this:

/volume1/Music/==-2012-==/-=New=-/ CLOSE_WRITE,CLOSE 06 Freak.mp3
Resetting 20 seconds timeout to restart...
/volume1/Music/==-2012-==/-=New=-/ CLOSE_WRITE,CLOSE 06 Freak.mp3
/volume1/Music/==-2012-==/-=New=-/ CLOSE_WRITE,CLOSE 06 Freak.mp3
/volume1/Music/==-2012-==/-=New=-/ CLOSE_WRITE,CLOSE 06 Freak.mp3


but the files doesnot show up on my upnp client
Find all posts by this user
Quote this message in a reply
07-01-2013, 08:52
Post: #7
RE: Auto Restart package for Synology users
(06-01-2013 23:23)alegend Wrote:  Sab moves files to a public available music dir with full access for the minimserver user. So i dont understand why it says permission denied....

I'm not sure yet under which circumstances inotifywait throws a permission denied error. I will try to reproduce this the next days.

Quote:I recognized that I have to refresh the dir. but i know it hasnt been restartet because my UPNP client (bubble upnp on android) doesnt show the new files.


when i copy a mp3 file into another dir the restart log shows this:

/volume1/Music/==-2012-==/-=New=-/ CLOSE_WRITE,CLOSE 06 Freak.mp3
Resetting 20 seconds timeout to restart...
/volume1/Music/==-2012-==/-=New=-/ CLOSE_WRITE,CLOSE 06 Freak.mp3
/volume1/Music/==-2012-==/-=New=-/ CLOSE_WRITE,CLOSE 06 Freak.mp3
/volume1/Music/==-2012-==/-=New=-/ CLOSE_WRITE,CLOSE 06 Freak.mp3


but the files doesnot show up on my upnp client

Please answer the following questions:
1) Which Synology DS model do you use and which version of DSM does it run?
2) How large is your music library? More specifically: how many files and directories does it contain?
3) When you did copy this mp3 file, how did you do that? Are you on a Windows machine?

I own a Synology DS211 and I have extensively tested the Auto restart package. However, the Minimserver status retrieving method may not be as robust as I thought. To help me sorting out this issue, please do the following:

1) Create a test directory (e.g. /volume1/Music/test) and put just one file into it.
2) Set the MinimServer contentDir property to this directory.
3) Stop MinimServer, the Auto Restart package and SABnzbd using the Synology package center. Reboot your NAS.
4) Start MinimServer and the Auto Restart package. Wait a few seconds.
5) Manually copy one file into the test directory and wait at least 2 minutes.
6) Post the full file restart.log (located in /homes/minimserver/autorestart) and the full file minimserver.log (located in /homes/minimserver/appData) here as an attachment.

Additionally, if you are familiar with it

7) Logon to your DS via SSH as root. Type
Code:
echo restart > /volume1/@tmp/minimstdinpipe
and see if MinimServer restarts.

Thanks!
Find all posts by this user
Quote this message in a reply
07-01-2013, 09:45 (This post was last modified: 07-01-2013 09:46 by alegend.)
Post: #8
RE: Auto Restart package for Synology users
Quote:Please answer the following questions:
1) Which Synology DS model do you use and which version of DSM does it run?
2) How large is your music library? More specifically: how many files and directories does it contain?
3) When you did copy this mp3 file, how did you do that? Are you on a Windows machine?
Currently im at work ... i will test what you told me later on when im home....
1)For now I can tell you that I use a DS411j with DSM 3.2 Build 1955.

2)I added only a small dir to the music library for testing of minimserver (i think around 500 files)

3) Im on windows and i copied with explorer, the windows user is logged in as admin.

I additonaly have to tell you that the inital installation of your package failed! I tried 3 times but never succeeded. So I installed GCC and MAKE via ipkg on the console....
Then i retried to install and it worked!
Find all posts by this user
Quote this message in a reply
07-01-2013, 18:59 (This post was last modified: 07-01-2013 19:00 by winxi.)
Post: #9
RE: Auto Restart package for Synology users
(07-01-2013 09:45)alegend Wrote:  Currently im at work ... i will test what you told me later on when im home....
1)For now I can tell you that I use a DS411j with DSM 3.2 Build 1955.

Hi,

is there a specific reason for you not updating to the latest DSM? If not, I highly encourage you to do so. This may update your linux kernel and glibc, both essential for inotifytools. Moreover, the Auto Restart package depends on system binaries which may be outdated with DSM 3.2. If this turns out to solve one of the related problems, I will make the Auto Restart package dependency on the firmware version more restrictive.

Quote:2)I added only a small dir to the music library for testing of minimserver (i think around 500 files)

3) Im on windows and i copied with explorer, the windows user is logged in as admin.

Both these points should be OK. I did tests with my library of about 20000 files using CIFS.

Quote:I additonaly have to tell you that the inital installation of your package failed! I tried 3 times but never succeeded. So I installed GCC and MAKE via ipkg on the console....
Then i retried to install and it worked!

The package installation relies on the bootstraps listed here. It is not possible for me to test all combinations of Synology models and firmware versions.
However, I'm glad you made the installation work and I'm interested in the reason for your installation problem. Unfortunately, the install-log containing the error is likely to be gone as you did a successful installation afterwards. So we have to investigate this by another way:

The installation procedure will basically do the following three steps:
1) Install ipkg using an appropriate bootstrapper
2) ipkg update, ipkg install gcc, ipkg install make
3) Download, compile and install inotify-tools

Which of these steps did you have to do manually? Please state the exact steps you made.
Do you remember the error message for which the Synology package center aborted the installation?
If you hat to do just step 2) the problem is likely to be due to an outdated version of the 'w g e t' binary which in turn may result from the old DSM version 3.2.

Best regards,
winxi
Find all posts by this user
Quote this message in a reply
07-01-2013, 21:38 (This post was last modified: 07-01-2013 21:39 by alegend.)
Post: #10
RE: Auto Restart package for Synology users
Quote:Hi,

is there a specific reason for you not updating to the latest DSM? If not, I highly encourage you to do so. This may update your linux kernel and glibc, both essential for inotifytools. Moreover, the Auto Restart package depends on system binaries which may be outdated with DSM 3.2. If this turns out to solve one of the related problems, I will make the Auto Restart package dependency on the firmware version more restrictive.
Reasons:
1. DS411j has only 128mb memory and new builds then 3.2 use a lot more ressources then the old 3.2.
2. I currently have only the most critical things backed up on an external disk but i dont want to risk to lose the other stuff too :-9
3. It doenst give me any advantage...im happy with my 3.2, it has fast speeds in transfer (read about a lot of speed problems with 4.x)
4. NEVER TOUCH A RUNNING SYSTEM - most of the time Im good with that. I would put 4.x on it if I would have a 1:1 backup but i dont have one!
=> I gotta get it working under 3.2
Quote:The package installation relies on the bootstraps listed here. It is not possible for me to test all combinations of Synology models and firmware versions.
However, I'm glad you made the installation work and I'm interested in the reason for your installation problem. Unfortunately, the install-log containing the error is likely to be gone as you did a successful installation afterwards. So we have to investigate this by another way:

The installation procedure will basically do the following three steps:
1) Install ipkg using an appropriate bootstrapper
2) ipkg update, ipkg install gcc, ipkg install make
3) Download, compile and install inotify-tools

Which of these steps did you have to do manually? Please state the exact steps you made.
Do you remember the error message for which the Synology package center aborted the installation?
If you hat to do just step 2) the problem is likely to be due to an outdated version of the 'w g e t' binary which in turn may result from the old DSM version 3.2.
Best regards,
winxi

Of course I installed the right bootstrap for my syno :_ ) i got a lot of other things running very well....
The installation procedure returned the error "please try again later" or anything like this - "currently not possible....)
so i opened putty and did
ipkg install gcc
ipkg install make
but the curious thing was - after the ipkg installs the package was already there?!?
i didnt reinstall it was in the packages center!


ps: are you german?


Attached File(s)
.zip  minimserver.zip (Size: 2.47 KB / Downloads: 13)
.zip  restart.zip (Size: 540 bytes / Downloads: 9)
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


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