1

Regarding one of my previous questions about minidlna (found here miniDLNA & srt files)

I want to know If (an how) I can install UMS (Universal Media Server) on a raspi. I also wonder if it can do the heavy lifting required.

Since my miniDLNA refused to stream .srt files with video I'm looking for an alternative.

Following this guide: http://www.slsmk.com/how-to-install-universal-media-server-ums-on-ubuntu-in-headless-mode/

I run into the following problem when trying to do:

 #  update-rc.d UMS defaults

update-rc.d: using dependency based boot sequencing
insserv: script UMS is not an executable regular file, skipped!
insserv: Script UMS is broken: incomplete LSB comment.
insserv: missing `Provides:' entry: please add.
insserv: missing `Required-Start:' entry: please add even if empty.
insserv: missing `Required-Stop:'  entry: please add even if empty.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Default-Start undefined, assuming empty start runlevel(s) for script `UMS'
insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `UMS'

the config file:

nano /etc/init.d/UMS

#!/bin/bash
#
### BEGIN INIT INFO
# Provides:          ums
# Required-Start:    $local_fs $remote_fs $network
# Required-Stop:     $local_fs $remote_fs $network
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Starts UMS program.
# Description:       Java Upnp Media Server
### END INIT INFO

#set -x

# Author: Papa Issa DIAKHATE 
#
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="Universal Media Server"
NAME=UMS
UMS_PROFILE=/etc/UMS.conf
DAEMON=/opt/ums/$NAME
DAEMON_OPTS="console"
SCRIPTNAME=/etc/init.d/$NAME
UMS_START=1 # Wether to start or not UMS ver at boot time.
DODTIME=30  # Time to wait for the server to die, in seconds.
            # If this value is set too low you might not
            # let the program to die gracefully and 'restart' will not work

test -x $DAEMON || exit 1

# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh

# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions

# Include ums defaults if available
if [[ -f "/etc/default/$NAME" ]] ; then
        . /etc/default/$NAME
fi

# May we run the init.d script ?
[[ $UMS_START = 1 ]] || exit 1

#--------------------------------------------------------------------------
# Some color codes
txtred=$'\e[0;31m' # Red
txtylw=$'\e[0;33m' # Yellow
txtrst=$'\e[0m'    # Text Reset
#--------------------------------------------------------------------------
warnout(){
    echo >&2 -e ""$txtylw"Warning:$txtrst $1"
}
#--------------------------------------------------------------------------
running(){
    pid=`pgrep -f 'java .*ums.jar.*'`
}
#--------------------------------------------------------------------------
do_start(){
    running && { warnout "$NAME is already running !"; exit 0; }
    echo "Starting $DESC : $NAME"
    UMS_PROFILE="$UMS_PROFILE" start-stop-daemon --start --quiet --background --oknodo \
        --exec $DAEMON -- $DAEMON_OPTS

}
#--------------------------------------------------------------------------
do_stop(){
    running || { warnout "$NAME is NOT running !"; exit 0; }   
    local countdown="$DODTIME"
    echo -e "Stopping $DESC : $NAME \c "
    kill -9 $pid
    while running; do
        if (($countdown >= 0)); then
            sleep 1; echo -n .;
            ((--countdown))
        else
            break;
        fi
    done
    echo
    # If still running, then try to send SIGINT signal
    running && { \
        echo >&2 "Using kill -s SIGINT instead"; \
        echo >&2 "If you see this message again, then you should increase the value of DODTIME in '$0'."; \
        kill -2 $pid; \
    }

    if [ -e "/opt/ums/debug.log" ]; then
    count=9
    while [ $count -ge 1 ]
    do
    if [ -e "/opt/ums/debug.log.$count" ]; then
        plus=$((count+1))
        mv "/opt/ums/debug.log.$count" "/opt/ums/debug.log.$plus"
    fi
        count=$((count-1))
    done
    if [ -e "/opt/ums/debug.log" ]; then
        mv "/opt/ums/debug.log" "/opt/ums/debug.log.1"
    fi
    fi

    return 0
}
#--------------------------------------------------------------------------
do_force-stop(){
    running || { warnout "$NAME is NOT running !"; exit 0; }   
    echo "Stopping $DESC : $NAME"
    kill -9 $pid
    if [ -e "/opt/ums/debug.log" ]; then
    count=9
    while [ $count -ge 1 ]
    do
    if [ -e "/opt/ums/debug.log.$count" ]; then
        plus=$((count+1))
   mv "/opt/ums/debug.log.$count" "/opt/ums/debug.log.$plus"
    fi
       count=$((count-1))
    done
    if [ -e "/opt/ums/debug.log" ]; then
   mv "/opt/ums/debug.log" "/opt/ums/debug.log.1"
    fi
    fi
}
#--------------------------------------------------------------------------
do_status(){
    echo -n " * $NAME is "
    ( running || { echo "NOT running "; exit 0; } )
    ( running && { echo "running (PID -> $(echo $pid))"; exit 0; } )
}
#--------------------------------------------------------------------------
case "$1" in

    start|stop|force-stop|status)
        do_${1}
        ;;
    restart|reload)
        do_stop
        do_start
        ;;
    force-restart|force-reload)
        do_force-stop
        do_start
        ;;
    *)
        echo "Usage: $SCRIPTNAME {start|stop|force-stop|restart|force-restart|reload|force-reload|status}"
        exit 1
        ;;
esac
1

The logs make me think the startup script is not provided. To run update-rc.d UMS defaults, you have to provide such a script (in /etc/init.d/). Make sure the file /etc/init.d/UMS exists.

  • insserv: script UMS is not an executable regular file, skipped!
    

    This line makes me think you have to make the script runnable. Run sudo chmod a+x /etc/init.d/UMS to make sure it has enough permissions to run.

  • insserv: missing `Provides:' entry: please add.
    insserv: missing `Required-Start:' entry: please add even if empty.
    insserv: missing `Required-Stop:'  entry: please add even if empty.
    insserv: missing `Default-Start:'  entry: please add even if empty.
    insserv: missing `Default-Stop:'   entry: please add even if empty.
    

    You have to provide the following lines at the beginning of the startup script:

    ### BEGIN INIT INFO
    # Provides:          UMS
    # Required-Start:    $local_fs
    # Required-Stop:     $local_fs
    # Default-Start:     2 3 4 5
    # Default-Stop:      0 1 6
    # Short-Description: Start/stop UMS
    ### END INIT INFO
    
  • insserv: Default-Start undefined, assuming empty start runlevel(s) for script `UMS'
    insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `UMS'
    

    You need the following code structure to run the script:

    case "$1" in
      start)
        # what to do to start UMS
        ;;
      stop)
        # what to do to start UMS
        ;;
      *)
        echo "Usage: /etc/init.d/UMS {start|stop}"
        exit 1
        ;;
    esac
    exit 0
    

Maybe a startup script already exists on your file system (try ls /etc/init.d/ | grep universal or ls /etc/init.d/ | grep media to find it), or on the Internet. Otherwise you will have to write your own (have a look here, or here)

  • # update-rc.d /etc/init.d/UMS defaults update-rc.d: using dependency based boot sequencing update-rc.d: error: unable to read /etc/init.d//etc/init.d/UMS It has also been made runable, and I use the file provided in the turorial, that file conains th einit info header aswell... – Havnar Sep 9 '14 at 12:21
  • also : # ls -l /etc/init.d | grep UMS -rwxr-xr-x 1 root root 4830 Sep 9 12:24 UMS – Havnar Sep 9 '14 at 12:26
  • @Havnar When I said "you have to provide such a script", I meant that /etc/init.d/UMS must exist. Not that you have to run update-rc.d /etc/init.d/UMS defaults. The command update-rc.d UMS defaults should be fine ;-) So you have an init.d script... Make sure there are no leading space before the #s at the beginning of the file. – Morgan Courbet Sep 9 '14 at 12:39
  • Thanks a lot, it were leading spaces before the #init info now it seems to work – Havnar Sep 9 '14 at 12:45
  • I came home but noticed even though it doesn't throw errors, it doesn't seem to work – Havnar Sep 9 '14 at 15:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.