<?sphp $this->text('pagetitle') ?>
 
Home of the Squeezebox™ & Transporter® network music players.

Debian startup script 1

From SqueezeboxWiki

Revision as of 05:04, 29 June 2010 by Soulkeeper (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

I was searching for a way to run slimserver at startup and found this from a post on forums by Werner Lane

1. Create a file /etc/default/slimserver which contains the following:

# Edit this to suit your setup
SLIMSERVER_USER="nobody"
SLIMSERVER_GROUP="nogroup"
SLIMSERVER_CFG="/mnt/shared/slimserver.conf"
SLIMSERVER_LOG="/var/log/slimserver.log"

2. Create a file /etc/init.d/slimserver which contains the following:

Note: See the LinuxInstallationGuide for other commands and debugging

possibilities you can add to the startupscript under SLIMSERVER_ARGS if you are having problems.

#! /bin/sh
## slimserver	Starts and stops the SlimServer
## Version:	1.0
## Edit this to suit your setup - partucularly the path to slimserver.pl
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/opt/SlimServer/slimserver.pl
NAME=slimserver
DESC="SliMP3 music server"
test -x $DAEMON || exit 0
set -e
# Source configuration parameters - this is the first file mentioned above. /etc/default/slimserver
SLIMSERVER_ARGS="--daemon --pidfile=/var/run/$NAME.pid --prefsfile=$SLIMSERVER_CFG \	--logfile=$SLIMSERVER_LOG --user=$SLIMSERVER_USER --group=$SLIMSERVER_GROUP"
case "$1" in  start)
	echo -n "Starting $DESC: $NAME"	start-stop-daemon --start --quiet --exec $DAEMON -- $SLIMSERVER_ARGS
	echo "."
	;;  stop)
	echo -n "Stopping $DESC: $NAME "
	start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid
	rm -f /var/run/$NAME.pid
        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 $DESC: $NAME"
	start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid	rm -f /var/run/$NAME.pid
	sleep 1
	start-stop-daemon --start --quiet --exec $DAEMON -- $SLIMSERVER_ARGS
	echo "."
	;;  *)
	N=/etc/init.d/$NAME
#	echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
	echo "Usage: $N {start|stop|restart|force-reload}" >&2
	exit 1
	;;
esac
exit 0

3. then run as root

%> chmod +x /etc/init.d/slimserver
%> update-rc.d slimserver defaults