PKGBUILDs/extra/slimserver/slimserver.rc
2009-10-09 21:23:22 -05:00

47 lines
967 B
Bash
Executable file

#!/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