Failing to change twonky default contendir - ini file always recreated

Hi,

I’m trying to give twonky an easier life by restricting the directories it has to crawl and index.

Instead of

Content Locations

contentdir=+A|/Public

I would like to have

contentdir=+M|/Public/Shared Music,+V|/Shared Videos,+P|/Shared Pictures

  1. If I make changes to the shares via the web ui on port 9000, these are not saved . next time I restart twonky they revert to default

  2. if I change what *appears* to be the master set of defaults at /usr/local/twonkymedia-5/twonkymedia-server-default.ini

and restart twonky , no change

  1. If I clear out the /CacheVolume/twonkymedia/ directory and restart twonky. My changes at 2) are not reflected in the new twonkymedia-server.ini that is recreated in /CacheVolume/twonkymedia directory

  2. If I stop twonky, edit the ini file in /CacheVolume/twonkymedia, then restart twonky, guess what. It gets overwritten within minutes.

My problem is I have media which I want twonky to index and I have some sysmtem backups , which may contain media but I don’t want twonky to index. They both share a common root of /Public. I’m trying to reduce the amount of content twonky needs to crawl , yet for all my efforts it seems like it always defaults

I’m wondering if I need to modify /etc/init.d/twonky and specify a new ini file on the command line, but before I do that I wanted to check and see if anyone else has had this problem ?

I think having Twonky scan the Public share is something that can’t be changed with the stock version that comes with the MBL, what if you follow the instructions in here to update Twonky?

OK - looking closer at /etc/init.d/twonky it appears that no matter what in in the .ini file, this is later overwritten by the values in /etc/contentdir

once I changed that to

+M|/Public/Shared Music,+V|/Shared Videos,+P|/Shared Pictures

those changes were retained and reflected in the webUI

this is interesting as having Twonky mapped to just /public seems to cause lots of people including myself issues with the drive not sleeping.

Yes - I think the problem is that if you have both media and other content in /Public (in my case complete incremental  backups of 2 PC’s), then twonky will be continuously re-indexing as files inevitably get updated.

I wanted to limit twony’s scope to just those folders with media.

I had thought about stopping and starting twonky from cron , for example through the night, just to try to get the MBL to a very quiet state.

I have to admit that the code on the MBL to determine when to sleep the device would appear to generate a good deal of IO, I’m erring toward reducing the worload to the minimum, while never actually sleeping the disks

My last MBW was never spun down, yet lasted 4 years

jives11 wrote:

OK - looking closer at /etc/init.d/twonky it appears that no matter what in in the .ini file, this is later overwritten by the values in /etc/contentdir

 

once I changed that to

 

+M|/Public/Shared Music,+V|/Shared Videos,+P|/Shared Pictures

 

those changes were retained and reflected in the webUI

Could you post a quick walk though on how to do this please.

Sure

  1. You need to enable ssh access to your MBL.

  2. You need to edit a text file called /etc/contentdir

  3. this file is owned by root, so you have 3 choices depending on how Linux familiar you are :

  • You can ssh into the server as a regular user and sudo nano /etc/contentdir - This is safest
  • You can ssh into the server as a regular user and su to root, then nano /etc/contentdir
  • You can ssh into the server as the root user. the default password is welc0me, then nano /etc/contentdir

Remember root can do everything including remove files which could brick the MBL, so take care.

  1. You can edit this file with an editor of choice. I think nano is safest as it’s easier for novice users and I noticed some tools already use it (crontab -e). vi is my old friend and I used it

  2. the file (/etc/contentdir)  has only one line in it. I made a copy of it first (/etc/contentdir.safe) using the cp (copy) command first

  3. I edited the file and replaced the existing entry with the line below:

+M|/Public/Shared Music,+V|/Public/Shared Videos,+P|/Public/Shared Pictures

This is the supported syntax from the  .ini files, and would seem to auto add the full directory path to the fron of each entry within twonky , so /shares is effectively an auto-basedir. If you are only interested in one kind of media,  then only add the part above for that type i.e if you only use Music then put

+M|/Public/Shared Music

7) Save the file back to /etc/contentdir

  1. Once done I restarted twonky with

# /etc/init.d/twonky stop

# /etc/init.d/twonky start

9) confirm the changes via the webUI in your desktop web browser (http://mybooklive:9000/config) then go to Sharing. You should see the directories you stated listed not /Public

10 ) if you run the top command in your shell you will see twonky consume the most CPU for a while but eventually settle down to doing very little, going from 99% CPU use to around 0.3% once setteled down.

1 Like

Thanks for that i will give this a try tonight, i have only tried SSH from the mac via terminal but could switch to linux, via virtual box.

terminal from the MAC is fine, that’s how I did it. My coment about Linux is because that is the OS of the MBL, so once you are SSH’d into the MBL you are in a Linux environment

I see that makes sense, just a quick question as I have not had time to look yet how do you get it to open the file.

jives11 wrote:

terminal from the MAC is fine, that’s how I did it. My coment about Linux is because that is the OS of the MBL, so once you are SSH’d into the MBL you are in a Linux environment

Not sure what you mean by opening the file. if you mean how do you invoke the file in the editor it is, at the shell prompt in the MBL

nano /etc/contentdir

That will open /etc/contentdir in the nano editor. Make your changes, then save & exit nano back to the shell

The script file used by the MBL to start twonky already knows the path to this file.

It should pick it up either the next time you restart the MBL or the next time you run the MBL Linux script

/etc/init.d/twonky restart

1 Like

Completed the fix thismorning and the settings have stuck, thanks for you advice, WD should note this for the next firmware