2004-04-16 09:13:30 -04:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# $FreeBSD$
|
|
|
|
#
|
|
|
|
|
|
|
|
# PROVIDE: slimserver
|
|
|
|
# REQUIRE: LOGIN
|
|
|
|
# KEYWORD: FreeBSD shutdown
|
|
|
|
|
|
|
|
#
|
|
|
|
# Add the following lines to /etc/rc.conf to enable slimserver:
|
|
|
|
#
|
|
|
|
#slimserver_enable="YES"
|
|
|
|
#
|
|
|
|
|
|
|
|
. %%RC_SUBR%%
|
|
|
|
|
|
|
|
name=slimserver
|
2004-05-03 18:59:03 -04:00
|
|
|
start_precmd="slimserver_start_precmd"
|
2004-04-16 09:13:30 -04:00
|
|
|
stop_cmd="slimserver_stop"
|
|
|
|
rcvar=`set_rcvar`
|
|
|
|
|
|
|
|
command=%%PREFIX%%/%%SLIMDIR%%/slimserver.pl
|
|
|
|
pidfile=/var/run/${name}.pid
|
|
|
|
conffile=/var/db/slimserver/slimserver.conf
|
|
|
|
logfile=/var/log/slimserver.log
|
|
|
|
u=slimserv
|
|
|
|
g=slimserv
|
|
|
|
command_args="--daemon --prefsfile=${conffile} --logfile=${logfile} --user=${u} --group=${g} --pidfile=${pidfile}"
|
|
|
|
|
2004-05-03 18:59:03 -04:00
|
|
|
PGREP=%%PGREPBASE%%/bin/pgrep
|
|
|
|
|
|
|
|
slimserver_start_precmd()
|
|
|
|
{
|
|
|
|
if [ ! -f ${conffile} ]; then
|
|
|
|
touch ${conffile}
|
|
|
|
chown slimserv:slimserv ${conffile}
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2004-04-16 09:13:30 -04:00
|
|
|
slimserver_stop()
|
|
|
|
{
|
|
|
|
if [ ! -f ${pidfile} ]; then
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
echo 'Stopping SlimServer.'
|
|
|
|
rc_pid=`cat ${pidfile}`
|
2004-05-03 18:59:03 -04:00
|
|
|
rc_pid=`${PGREP} -u ${u} | grep ${rc_pid}`
|
2004-04-16 09:13:30 -04:00
|
|
|
if [ -n "${rc_pid}" ]; then
|
2004-05-03 18:59:03 -04:00
|
|
|
# Should be mDNSResponderPosix, but the port truncates
|
|
|
|
rc_pids="${rc_pid} `${PGREP} -u ${u} mDNSResponderPos`"
|
2004-04-16 09:13:30 -04:00
|
|
|
|
|
|
|
kill $sig_stop $rc_pids
|
|
|
|
wait_for_pids $rc_pids
|
|
|
|
else
|
|
|
|
echo "${name} not running? (check ${pidfile})"
|
|
|
|
fi
|
|
|
|
|
|
|
|
rm -f ${pidfile}
|
|
|
|
}
|
|
|
|
|
|
|
|
# set defaults
|
|
|
|
|
|
|
|
slimserver_enable=${slimserver_enable:-"NO"}
|
|
|
|
slimserver_flags=${slimserver_flags:-""}
|
|
|
|
|
|
|
|
load_rc_config ${name}
|
|
|
|
run_rc_command "$1"
|