service doen't get started at boottime, but can start manually
O. Hartmann
ohartman at zedat.fu-berlin.de
Sun Sep 7 19:23:36 UTC 2014
Am Sun, 7 Sep 2014 11:16:37 -0500
Scot Hetzel <swhetzel at gmail.com> schrieb:
> On Sun, Sep 7, 2014 at 10:44 AM, Scot Hetzel <swhetzel at gmail.com> wrote:
> > I created the rc.d/refdbd script by copying /etc/rc.d/inetd and make a
> > few minor changes.
> > This script (untested) should do what the scripts/refdb.in and
> > scripts/refdbctl.in were doing:
> >
> > #!/bin/sh
> > #
> > # $FreeBSD$
> > #
> >
> > # PROVIDE: refdbd
> > # REQUIRE: LOGIN
> > # KEYWORD: shutdown
> >
> > . /etc/rc.subr
> >
> > name="refdbd"
> > rcvar="refdbd_enable"
> > command="%%PREFIX%%/bin/${name}"
> > pidfile="/var/run/${name}.pid"
> > required_files="/etc/${name}.conf"
>
> I missed required_files in my editing of the original script.
>
> If refdbd does have a configuration file, changes this to point to the
> correct file, otherwise this can be removed.
>
> > extra_commands="reload"
> >
> > load_rc_config $name
> > run_rc_command "$1"
> >
> > Place the above in textproc/refdb/files/refdb.in, then add:
> >
> > USE_RC_SUBR= refdbd
> >
> > in textproc/refdb/Makefile.
> >
>
Scot,
I already have a initial refdbd frameworked file, thanks for your considerations.
I think the following code is suitable for a clean FreeBSD-style rc.d file for the port.
I managed it to restart, status and start/stop via this rc.d-init script and it is for
the upcoming refdb-1.0.3 which is in preparation.
I need to mimik the refdbctl code at the point where it is looking for the configuration
of the PID file via refdbdrc in %%PREFIX%%/etc/refdb/. I havn't tested the code properly,
yet, but it worked as far a I could test it.
Regards,
Oliver Hartmann
[...]
#!/bin/sh
#
# $FreeBSD$
#
# O. Hartmann, Berlin, 2014
#
#
# PROVIDE: refdbd
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# To enable this service, place
#
# refdbd_enable="YES"
#
# in /etc/rc.conf[.local]
#
# and optionally set the the following variables upon your environment:
#
# Choose another PIDFILE as the configured and/or default one:
# refdbd_pidfile="/var/run/refdbd.pid"
#
# To make the refdbd daemon accessible local only (127.0.0.1):
# refdbd_local="YES"
. /etc/rc.subr
name="refdbd"
rcvar=refdbd_enable
# read settings, set defaults
load_rc_config ${name}
command="%%PREFIX%%/bin/${name}"
globalconfig="%%PREFIX%%/etc/refdb/refdbdrc"
pidfile="/var/run/${name}.pid"
extra_commands="reload"
load_rc_config ${name}
: ${refdbd_enable:="NO"}
: ${refdbd_local:="NO"}
if checkyesno refdbd_local; then
refdbd_local_flags="-I"
else
refdbd_local_flags=""
fi
start_precmd="${name}_prestart"
refdbd_prestart()
{
local refdbvar refdbval
# Check whether we have configured a PID file
if [ "x${refdbd_pidfile}" != "x" ]; then
pidfile="${refdbd_pidfile}"
# ... if not configured via rc.conf[.local],
# read the settings in the configure file. We're only interested in
# nonstandard PID file settings
else
for config in ${globalconfig}; do
while read refdbvar refdbval; do
if [ -n "${refdbvar}" ]; then
if [ ${refdbvar}="pidfile" ]; then
pidfile=${refdbval}
fi
fi
done < $config
done
fi
piddir=`dirname ${pidfile}`
mkdir -p ${piddir}
refdbd_pid_flags="-P ${pidfile}"
}
# Set command arguments upon configuration
command_args="${refdbd_local_flags} ${refdbd_pid_flags}"
run_rc_command "$1"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-current/attachments/20140907/352fa1c2/attachment.sig>
More information about the freebsd-current
mailing list