minidlna init script

291 views
Skip to first unread message

Joao Cardoso

unread,
Nov 19, 2010, 2:13:55 PM11/19/10
to Alt-F
minidlna seems to only run with the "-d" option flag, and also can't
create its pid file.

As an interim solution, after installing minidlna, replace /etc/init.d/
S80minidlna with the file bellow.
minidlna will run as root.

The good news is that minidlna has a new stable source code release
(the package will only be available after 0.1B6 is released)

-----8<---------------
#!/bin/sh -e

NAME=minidlna
DESC="MiniDLNA is a DLNA/UPnP-AV server."
TYPE=user

CONFF=/etc/$NAME.conf
MINIDLNA_USER=$NAME
MINIDLNA_GROUP=multimedia
MINIDLNA_ARGS="-d"

. $(dirname $0)/common

check_shares() {
if test -r "$CONFF"; then
MDLNA_DIR="$(awk -F= '/^media_dir/{printf "%s;", $2}' $CONFF)"
OIFS="$IFS"; IFS=";"
for i in $MDLNA_DIR; do
if test ! -d "$i"; then
echo "Share $i does not exist."
exit 1
else
conf_ok=1
fi
done
IFS="$OIFS"
if test -z "$conf_ok"; then
echo "No shares configured."
exit 1
fi
return 0
fi
echo "Configuration file does not exist."
exit 1
}

case "$1" in

start)
echo -n "Starting $NAME: "
check_shares
minidlna -d > /var/lib/minidlna/minidlna.log 2>&1 &
omsg $?
;;

stop) stop $NAME 2 ;;
status) status $NAME ;;
restart) restart $NAME ;;
*)
echo "Usage: $0 {start|stop|status|restart}"
exit 1
;;
esac

Hamish Campbell

unread,
Nov 20, 2010, 3:32:20 AM11/20/10
to Alt-F
Hej Joao,

I'm getting a user permissions error when trying to run with this
script.
/etc/init.d/S80minidlna: line 48: /etc/minidlna.conf: Permission
denied

So seems it's with minidlna.conf, which I took at look at and it was
root:root.

So I changed it to minidlna:multimedia, but no better.

First, I don't know jack about scripting but....
I can see the script sets user and group in variables, but is the user
really set with those variables, I would have expected an su command.
Otherwise I could believe the '2' in the start call is to specify the
user to run as, however I don't see where that is set. Smart guy me
has overwritten the script, so can't compare with the old....i'll see
if I can find it on the homepage.

On Nov 19, 8:13 pm, Joao Cardoso <whoami.jc...@gmail.com> wrote:

Hamish Campbell

unread,
Nov 20, 2010, 3:55:07 AM11/20/10
to Alt-F

Sorry, forget all that, I'm a fool.

I had copy pasted your new script in and didn't check the paste, so
there was a carriage return in a line.
So when i got rid of that it started up fine...


AND.....

It works!! Very nice :)

Coherence plug in within rythmbox on my ubuntu laptop can see the nas,
can see jpg's, mp3s and videos. And plays the mp3s and videos.

Cool. Thanks again.

Now I just need a dlna client for my telly (it has one that can play
almost nothing! so need wdlive or blueray player with dlna).

So only netatalk outstanding for me, if that gets going I think my
plan will be:

Test that mac timemachine backup works.
Wait for B6 and test.
if fine then look at flashing the firmware if it's safe enough.
Copy a few things off the nas,
Reformat my disk seeing as it's the EARS 4K from WD, it may not be an
issue, but may as well do it properly.
Copy back on.
Get backups working regularly and move kids movies over to nas.

Will be cool.
Reply all
Reply to author
Forward
0 new messages