PDA

View Full Version : Debian Slimserver



Daniel Agar
2006-03-28, 08:49
I use the slimserver tar ball to run slimserver on debian but debian
refuses to have an rc.local file. Anyone know how to make a proper init
script to have slimserver launch on startup in a debian environment?

Millwood
2006-03-28, 09:07
debian has a complex runlevel scheme that seems to me poorly documented. read the man pages for init.

the rc files are in directories like /etc/rc.2 associated with run levels. AFAIK run level 2 is normal multiuser mode.

you add a startup file to the rc.2 directory to start things in normal mode, I think.

there may be other/better ways - I'm not an expert.

Ben Sandee
2006-03-28, 09:13
On 3/28/06, Daniel Agar <daniel (AT) agar (DOT) ca> wrote:
>
> I use the slimserver tar ball to run slimserver on debian but debian
> refuses to have an rc.local file. Anyone know how to make a proper init
> script to have slimserver launch on startup in a debian environment?


Daniel,

If you're using the 6.5 branch (development) then you have the option of
using the .deb directly. See:

http://www.slimdevices.com/downloads/nightly/latest/6.5/slimserver_6.5b1_all.deb

Even if you aren't using 6.5, you can problem find a startup script that you
can modify. Alternatively, I've posted my slimserver startup script -- I
place it in /etc/init.d/slimserver and then soft link from
/etc/rc2.d/S99slimserver to /etc/init.d/slimserver. This scirpt hardcodes
the slimserver distribution into /usr/local/src/slimserver and configuration
into /usr/local/etc. YMMV.

Ben

set -e

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
NAME=slimserver
DAEMON=/usr/local/src/slimserver/slimserver.pl
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME

DESC="$NAME daemon"
OPTIONS="--daemon --logfile /var/log/$NAME.log --prefsfile
/usr/local/etc/$NAME.pref --pidfile $PIDFILE"

# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0

case "$1" in
start)
echo -n "Starting $DESC: $NAME"
rm -f $PIDFILE
start-stop-daemon --start --quiet --pidfile $PIDFILE \
--exec $DAEMON -- $OPTIONS
echo "."
;;
stop)
echo -n "Stopping $DESC: $NAME"
start-stop-daemon --stop --quiet --pidfile $PIDFILE
rm -f $PIDFILE
echo "."
;;
restart|force-reload|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 --oknodo --pidfile $PIDFILE
rm -f $PIDFILE
sleep 1
start-stop-daemon --start --quiet --pidfile \
$PIDFILE --exec $DAEMON -- $OPTIONS
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

snarlydwarf
2006-03-28, 09:17
well ideally you'd add it to /etc/init.d -- this is where all the real scripts go. Name it 'slimserver' or something.

Then something like:

update-rc.d slimserver defaults 90

(Where 'slimserver' is the name of the init.d script.)

This will put links in /etc/rc2.d to start up slimserver when the networking and put it towards the end of things starting. You can change the 90 if you want, but that ensures it's up after things like Samba or other services it may need.