#!/bin/bash # source application-specific settings [ -f /etc/conf.d/slimserver ] && . /etc/conf.d/slimserver # general config . /etc/rc.conf . /etc/rc.d/functions slimhome=/home/slimserver pidfile=/var/run/slimserver.pid logfile=/var/log/slimserver.log prefsfile=/home/slimserver/.slimserver.pref cachedir=/var/cache/slimserver case "$1" in start) stat_busy "Starting SlimServer" cd $slimhome ./slimserver.pl --daemon --user slimserver --prefsfile $prefsfile \ --cachedir $cachedir --pidfile $pidfile --logfile $logfile $SLIMSERVER_OPTS if [ $? -gt 0 ]; then stat_fail else add_daemon slimserver stat_done fi ;; stop) stat_busy "Stopping SlimServer" kill `cat $pidfile` &>/dev/null if [ $? -gt 0 ]; then stat_fail else rm_daemon slimserver stat_done fi ;; restart) $0 stop sleep 3 $0 start ;; *) echo "usage: $0 {start|stop|restart}" esac