Apologies for my n00bishness, getting back into Linux after a long time away. I was previously using DD-WRT but wanted a bit more flexibility on my Archer C7 v2s to do things like run Transmission Daemon and miniDLNA. (DD did the DLNA well, but the build for my particular model of router kept throwing roadblocks in my face, and had a bunch of features like VPN that I have no use for).
I've got the services running the way I want but when I copy files into the DLNA media folders they are not automatically discovered. I've read some forum articles for other versions of miniDLNA that give some ideas but nothing seems to work.
Since I'm manually copying files from one folder into the media folder, what I would like to do is make a simple bash script to do the following:
rescandb.sh
#!/bin/sh #I'll add a chmod/chown here to make sure any newly copied files match the ownership/permissions of the rest of the folder
service minidlna stop
minidlnad -R
service minidlna start
When I attempt to run said script I get the following error:
root@OpenWrt:/mnt/media/DLNA# ./rescandb.sh
./rescandb.sh: line 3: service: not found
./rescandb.sh: line 5: service: not found
I'm sure I'm just missing something basic, but any help would be largely appreciated. I have a crap memory and it's less effective for me to remember the sytax for stopping services etc every time I add new media.
You've probably already looked into this, but just in case you can set the notify function to scan more frequently, it's set in seconds and default is 900 i think (15 minutes), so you could set it to 300 (5 minutes) or whatever you'd like to discover new files quicker.
I had looked into that setting on a variety of other forums, it's apparently related to how often the server announces itself on the network, rather than how often it scans for content.
I've also added content and left it overnight to see if it would appear automagically.
I had read in a raspberry pi minidlna forum that correctly configuring inotify on the system would allow the daemon to be alerted of directory changes, but haven't found anything specific to OpenWRT yet. I'm not overly concerned with it happening automatically as I don't add to my library that often.
inotify is set to 1 by default, which seems to indicate it's enabled. I wonder if there are configurations missing in OpenWRT rather than miniDLNA.
not being terribly concerned about automagically rescanning, I was more interrested in scripting something that I could run manually after copying in files (which I also do manually).
if I can get it to happen using inotify even better, but I'm not fixated on that outcome.