1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-18 03:46:03 +00:00
freebsd-ports/misc/dnetc/files/dnetc.sh.in
Doug Barton c49d1a3273 Remove the FreeBSD KEYWORD from all rc.d scripts where it appears.
We have not checked for this KEYWORD for a long time now, so this
is a complete noop, and thus no PORTREVISION bump. Removing it at
this point is mostly for pedantic reasons, and partly to avoid
perpetuating this anachronism by copy and paste to future scripts.
2006-02-20 20:47:50 +00:00

77 lines
1.4 KiB
Bash

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: dnetc
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable dnetc:
# dnetc_enable (bool): Set to "NO" by default.
# Set to "YES" to enable dnetc.
# dnetc_dir (path): Set to "%%BINDIR%%" by default.
# dnetc_user (user): Set to "%%CLIENTUSER%%" by default.
#
. %%RC_SUBR%%
name="dnetc"
rcvar=`set_rcvar`
load_rc_config $name
: ${dnetc_enable="NO"}
: ${dnetc_dir="%%BINDIR%%"}
: ${dnetc_user="%%CLIENTUSER%%"}
required_files=${dnetc_dir}/${name}.ini
start_cmd="${name}_start"
stop_cmd="${name}_stop"
extra_commands="flush fetch update"
flush_cmd="${name}_flush"
fetch_cmd="${name}_fetch"
update_cmd="${name}_update"
dnetc_start()
{
if ps -x -o ucomm -U${dnetc_user} | grep ${name} >/dev/null; then
echo "${name} already running?"
else
su -m ${dnetc_user} -c "${dnetc_dir}/${name} -quiet" >/dev/null 2>&1
echo -n " ${name}"
fi
}
dnetc_stop()
{
if ps -x -o ucomm -U${dnetc_user} | grep ${name} >/dev/null; then
su -m ${dnetc_user} -c "${dnetc_dir}/${name} -shutdown" >/dev/null 2>&1
# wait for dnetc to stop
sleep 2
echo -n " ${name}"
else
echo "${name} not running?"
fi
}
dnetc_flush()
{
su -m ${dnetc_user} -c "${dnetc_dir}/${name} -flush" >/dev/null 2>&1
}
dnetc_fetch()
{
su -m ${dnetc_user} -c "${dnetc_dir}/${name} -fetch" >/dev/null 2>&1
}
dnetc_update()
{
su -m ${dnetc_user} -c "${dnetc_dir}/${name} -update" >/dev/null 2>&1
}
run_rc_command "$1"