The one line change you suggest is something I ready did earlier today. 
So the initscript becomes:


Code:
--------------------
    
  #!/bin/sh
  #
  # $Id$
  #
  # logitechmediaserver initscript for slimserver.pl
  #                     This file should be placed in /etc/init.d.
  #
  # Original Author: Mattias Holmlund
  #
  # Updated By: Dan Sully, Michael Herger
  
  #
  ### BEGIN INIT INFO
  # Provides:           logitechmediaserver
  # Required-Start:     $all
  # Required-Stop:      $all
  # Should-Start:       $all
  # Should-Stop:        $all
  # Default-Start:      2 3 4 5
  # Default-Stop:       0 1 6
  # Short-Description:  Startup script for the Logitech Media Server
  # Description:                Logitech Media Server powers the Squeezebox, 
Transporter and SLIMP3 network music \
  #                     players and is the best software to stream your music 
to any software MP3 \
  #                     player. It supports MP3, AAC, WMA, FLAC, Ogg Vorbis, 
WAV and more! \
  #                     As of version 7.7 it also supports UPnP clients, 
serving pictures and movies too!"
  ### END INIT INFO
  #
  
  set -e
  
  PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
  DESC="Logitech Media Server"
  NAME=squeezeboxserver
  NEWNAME=logitechmediaserver
  #DAEMON=/usr/sbin/$NAME
  DAEMON=//opt/logitechmediaserver-7.7.2-33893-noCPAN/slimserver.pl
  DAEMON_SAFE=/usr/sbin/${NAME}_safe
  PIDFILE=/var/run/$NEWNAME.pid
  SCRIPTNAME=/etc/init.d/$NEWNAME
  SLIMUSER=$NAME
  PREFSDIR=/var/lib/$NAME/prefs
  LOGDIR=/var/log/$NAME/
  CACHEDIR=/var/lib/$NAME/cache
  CHARSET=utf8
  SLIMOPTIONS=
  
  # Read config file if it is present.
  if [ -r /etc/default/$NEWNAME ]; then
        . /etc/default/$NEWNAME
  elif [ -r /etc/default/$NAME ]; then
        . /etc/default/$NAME
  fi
  
  #
  #     Function that starts the daemon/service.
  #
  d_start() {
  # Use squeezeboxserver_safe to restart the daemon when
  # it dies. This must be done to handle mysql restarts.
        start-stop-daemon --start --quiet \
  --chuid $SLIMUSER \
  --pidfile $PIDFILE \
                --exec $DAEMON_SAFE \
  --background \
  --make-pidfile \
  -- \
  $DAEMON \
  --prefsdir $PREFSDIR \
  --logdir $LOGDIR \
  --cachedir $CACHEDIR \
                --charset=$CHARSET \
  $SLIMOPTIONS
  }
  
  d_start_direct() {
        start-stop-daemon --start --quiet \
  --chuid $SLIMUSER \
  --pidfile $PIDFILE \
                --exec $DAEMON \
  -- \
  --pidfile $PIDFILE \
  --daemon \
  --prefsdir $PREFSDIR \
  --logdir $LOGDIR \
  --cachedir $CACHEDIR \
                --charset=$CHARSET \
  $SLIMOPTIONS
  }
  
  #     Function that stops the daemon/service.
  #
  d_stop() {
  
        ## This is a bug in the start-stop-daemon that checks the PID name from 
the /proc/PID/stat filesystem...
        ## Unfortunately this cuts-off the name of the daemon because its 
longer now, and then it doesnt get 
        ## caught by the start-stop-daemon. The daemon actually reports it as 
squeezeboxserve instead of 
        ## squeezeboxserver_safe.
        start-stop-daemon --oknodo --stop --pidfile $PIDFILE 
--retry=TERM/30/KILL/5
  }
  
  #
  #     Function that sends a SIGHUP to the daemon/service.
  #
  d_reload() {
        start-stop-daemon --stop --quiet --pidfile $PIDFILE --signal 1
  }
  
  case "$1" in
  start)
        echo -n "Making sure that $DESC is not running first: "
        d_stop
        echo -n "Starting $DESC"
        d_start
        echo "."
        ;;
  stop)
        echo -n "Stopping $DESC"
        d_stop
        echo "."
        ;;
  restart|force-reload)
        #
        #       If the "reload" option is implemented, move the "force-reload"
        #       option to the "reload" entry above. If not, "force-reload" is
        #       just the same as "restart".
        #
        echo -n "Restarting $NAME"
        d_stop
        d_start
        echo "."
        ;;
  *)
        # echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
        echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
        exit 1
        ;;
  esac
  
  exit 0
  
  
--------------------


But it doesn't appear that simple as the debian way uses 2 deamons, and
there's nothing to replace /usr/sbin/squeezeboxserver_safe.  Hence
/etc/init.d/logitechmedaiserver appears to start, but in fact the
server.log shows:


Code:
--------------------
    
  2013-09-03 22:19:05 Logitech Media Server died. Restarting.
  2013-09-03 22:19:10 Logitech Media Server died. Restarting.
  2013-09-03 22:19:15 Logitech Media Server died. Restarting.
  2013-09-03 22:19:20 Logitech Media Server died. Restarting.
  2013-09-03 22:19:25 Logitech Media Server died. Restarting.
  2013-09-03 22:19:30 Logitech Media Server died. Restarting.
  2013-09-03 22:19:35 Logitech Media Server died. Restarting.
  
--------------------
 

Hence I tried to a least test the build trying to start ./slimerver.pl
directly with appropriate options.   I gave up for the moment.  This old
debian script might be made to work:

https://wiki.debian.org/SlimServerHowto

I haven't given any more time to it yet.  Otherwise, I guess I'll just
wait to for a .deb file.


------------------------------------------------------------------------
Krisbee's Profile: http://forums.slimdevices.com/member.php?userid=59080
View this thread: http://forums.slimdevices.com/showthread.php?t=99584

_______________________________________________
unix mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/unix

Reply via email to