87f39b0573
lack the daemon(8) utility.
74 lines
2.1 KiB
Bash
74 lines
2.1 KiB
Bash
#!/bin/sh
|
|
#
|
|
# $FreeBSD$
|
|
#
|
|
|
|
# PROVIDE: svscan
|
|
# REQUIRE: LOGIN
|
|
# KEYWORD: FreeBSD
|
|
|
|
# Define these svscan_* variables in one of these files:
|
|
# /etc/rc.conf
|
|
# /etc/rc.conf.local
|
|
# /etc/rc.conf.d/svscan
|
|
#
|
|
# DO NOT CHANGE THESE DEFAULT VALUES HERE
|
|
#
|
|
|
|
# It would really, really be a Good Thing(tm) for you to enable some
|
|
# of the below control variables and the apropriate ulimit.
|
|
# These are only examples.
|
|
# Furthermore, you should think about additional limits you might need.
|
|
# Or, check login.conf(5) for a suitable alternative.
|
|
# If you want to use these examples, please place into /etc/rc.conf.d/svscan.
|
|
#
|
|
# I really do suggest you use /var/service as your service spool directory.
|
|
# Check hier(7) for reasons.
|
|
|
|
# 10 Mb
|
|
#MINSEGMENT=10240
|
|
# 20 Mb
|
|
#MAXSEGMENT=20480
|
|
# 10 Mb
|
|
#MAXFILESIZE=10240
|
|
# 100
|
|
#MAXFD=100
|
|
# 40
|
|
#MAXCHILD=40
|
|
|
|
# ulimits
|
|
#ulimit -d ${MINSEGMENT}
|
|
#ulimit -f ${MAXFILESIZE}
|
|
#ulimit -m ${MAXSEGMENT}
|
|
#ulimit -n ${MAXFD}
|
|
#ulimit -s ${MINSEGMENT}
|
|
#ulimit -u ${MAXCHILD}
|
|
|
|
. %%RC_SUBR%%
|
|
|
|
name="svscan"
|
|
rcvar=`set_rcvar`
|
|
command="%%PREFIX%%/bin/svscan"
|
|
svscan_enable=${svscan_enable-"NO"}
|
|
svscan_servicedir=${svscan_servicedir-"/var/service"}
|
|
|
|
start_cmd="svscan_start"
|
|
stop_postcmd="svscan_stop_post"
|
|
|
|
load_rc_config $name
|
|
|
|
required_dirs="${svscan_servicedir}"
|
|
|
|
svscan_start () {
|
|
echo "Starting svscan."
|
|
/usr/bin/env \
|
|
PATH=%%PREFIX%%/sbin:%%PREFIX%%/bin:/usr/sbin:/usr/bin:/sbin:/bin \
|
|
%%DAEMON%% /bin/sh -c "$command $svscan_servicedir 2>&1 | %%PREFIX%%/bin/readproctitle service errors: ................................................................................................................................................................................................................................................................................................................................................................................................................ &" > /dev/null
|
|
}
|
|
|
|
svscan_stop_post () {
|
|
echo "Stopping svscan."
|
|
find -L "$svscan_servicedir" -maxdepth 2 -type d \( -depth 1 -or \( -depth 2 -name 'log' \) \) -print0 | xargs -0 %%PREFIX%%/bin/svc -dx
|
|
}
|
|
|
|
run_rc_command "$1"
|