freebsd-ports/comms/conserver-com/files/conserver.sh.in
Hiroki Sato a8994cf080 Update to 8.1.16. Changes include:
- added 'replstring' substitution option - inspired by
   conversation with Owen DeLong <owen@c2company.com>
 - added '^Ecn' option for writing a note to the logfile - patch
   by Bryan Schmersal <bschmer@yahoo.com>
 - fixed leaking file descriptors when 'host' and 'uds' consoles
   fail to connect - based on patch by Michael Heironimus
   <michael_heironimus@archwayconcepts.com>

Also, the rc.d script now supports "reload", "reconnect",
and "reinit" keywords (they are to send HUP/USR1/USR2
respectively).

Approved by:	kuriyama (maintainer)
2007-08-27 20:07:08 +00:00

56 lines
928 B
Bash

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: conserver
# REQUIRE: DAEMON
# KEYWORD: shutdown
. %%RC_SUBR%%
name="conserver"
rcvar=`set_rcvar`
command=%%PREFIX%%/sbin/${name}
pidfile=/var/run/${name}.pid
required_files=%%PREFIX%%/etc/${name}.cf
extra_commands="reload reconnect reinit"
reconnect_cmd="reconnect_cmd"
reinit_cmd="reinit_cmd"
load_rc_config $name
: ${conserver_enable="NO"}
: ${conserver_flags="-d"}
kill_cmd()
{
_msg=$1
_sig=$2
if [ -z "$rc_pid" ]; then
if [ -n "$pidfile" ]; then
echo 1>&2 \
"${name} not running? (check $pidfile)."
else
echo 1>&2 "${name} not running?"
fi
return 1
fi
echo "$_msg"
kill -${_sig:-HUP} $rc_pid
_return=$?
[ $_return -ne 0 ] && [ -z "$rc_force" ] && return 1
}
reconnect_cmd()
{
kill_cmd "Try to reconnect all downed consoles." USR1
}
reinit_cmd()
{
kill_cmd "Try to close and reopen all log files and downed connections." USR2
}
run_rc_command "$1"