From owner-freebsd-current@FreeBSD.ORG Sun Sep 7 19:23:36 2014 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 86373126; Sun, 7 Sep 2014 19:23:36 +0000 (UTC) Received: from outpost1.zedat.fu-berlin.de (outpost1.zedat.fu-berlin.de [130.133.4.66]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 36F8D103D; Sun, 7 Sep 2014 19:23:35 +0000 (UTC) Received: from inpost2.zedat.fu-berlin.de ([130.133.4.69]) by outpost.zedat.fu-berlin.de (Exim 4.82) with esmtp (envelope-from ) id <1XQi3b-000apw-Cx>; Sun, 07 Sep 2014 21:23:27 +0200 Received: from g225112056.adsl.alicedsl.de ([92.225.112.56] helo=thor.walstatt.dynvpn.de) by inpost2.zedat.fu-berlin.de (Exim 4.82) with esmtpsa (envelope-from ) id <1XQi3b-001vBm-9m>; Sun, 07 Sep 2014 21:23:27 +0200 Date: Sun, 7 Sep 2014 21:23:22 +0200 From: "O. Hartmann" To: Scot Hetzel Subject: Re: service doen't get started at boottime, but can start manually Message-ID: <20140907212322.4f2d370f.ohartman@zedat.fu-berlin.de> In-Reply-To: References: <20140907090321.12bbc428.ohartman@zedat.fu-berlin.de> <20140907153342.2366ad8b@X220.alogt.com> <20140907094308.6c466d9f.ohartman@zedat.fu-berlin.de> <20140907112811.5570fc85.ohartman@zedat.fu-berlin.de> Organization: FU Berlin X-Mailer: Claws Mail 3.10.1 (GTK+ 2.24.22; amd64-portbld-freebsd11.0) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; boundary="Sig_/bqP79W9lE9.IooexXALO8p5"; protocol="application/pgp-signature" X-Originating-IP: 92.225.112.56 X-ZEDAT-Hint: A Cc: FreeBSD CURRENT , FreeBSD Ports , Erich Dollansky X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Sep 2014 19:23:36 -0000 --Sig_/bqP79W9lE9.IooexXALO8p5 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Am Sun, 7 Sep 2014 11:16:37 -0500 Scot Hetzel schrieb: > On Sun, Sep 7, 2014 at 10:44 AM, Scot Hetzel 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=3D"refdbd" > > rcvar=3D"refdbd_enable" > > command=3D"%%PREFIX%%/bin/${name}" > > pidfile=3D"/var/run/${name}.pid" > > required_files=3D"/etc/${name}.conf" >=20 > I missed required_files in my editing of the original script. >=20 > If refdbd does have a configuration file, changes this to point to the > correct file, otherwise this can be removed. >=20 > > extra_commands=3D"reload" > > > > load_rc_config $name > > run_rc_command "$1" > > > > Place the above in textproc/refdb/files/refdb.in, then add: > > > > USE_RC_SUBR=3D refdbd > > > > in textproc/refdb/Makefile. > > >=20 Scot, I already have a initial refdbd frameworked file, thanks for your considera= tions. 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 an= d 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=3D"YES" # # in /etc/rc.conf[.local] #=20 # and optionally set the the following variables upon your environment: # # Choose another PIDFILE as the configured and/or default one: # refdbd_pidfile=3D"/var/run/refdbd.pid" # # To make the refdbd daemon accessible local only (127.0.0.1): # refdbd_local=3D"YES" . /etc/rc.subr name=3D"refdbd" rcvar=3Drefdbd_enable # read settings, set defaults load_rc_config ${name} command=3D"%%PREFIX%%/bin/${name}" globalconfig=3D"%%PREFIX%%/etc/refdb/refdbdrc" pidfile=3D"/var/run/${name}.pid" extra_commands=3D"reload" load_rc_config ${name} : ${refdbd_enable:=3D"NO"} : ${refdbd_local:=3D"NO"} if checkyesno refdbd_local; then refdbd_local_flags=3D"-I" else refdbd_local_flags=3D"" fi start_precmd=3D"${name}_prestart" refdbd_prestart() { local refdbvar refdbval # Check whether we have configured a PID file if [ "x${refdbd_pidfile}" !=3D "x" ]; then pidfile=3D"${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}=3D"pidfile" ]; then pidfile=3D${refdbval} fi fi done < $config done fi piddir=3D`dirname ${pidfile}` mkdir -p ${piddir} refdbd_pid_flags=3D"-P ${pidfile}" } # Set command arguments upon configuration command_args=3D"${refdbd_local_flags} ${refdbd_pid_flags}" run_rc_command "$1" --Sig_/bqP79W9lE9.IooexXALO8p5 Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBAgAGBQJUDLCuAAoJEOgBcD7A/5N8aN8IAMbevzPk4U29a0a7PiJgJNKl Cb7PZEWYi3lkd//tOORJ+F7fKIeKgSj70DY7OoMN3xkF0uoECa6ql28R8Iwb/8w4 e2loMTF4JDxVT5nuMfY7eHD3emI+ru/27OlFhpW9RIOeD+DD7Fs/nLywlxzuebMm mmZBplY6waqWbS5tL0f97bREi0pAxBRe6Sl1hB/CLNXi71DDkR5q45X8Xo6FaSaR QTrXKC6tTt4/qDmW3gPOTDqZACZSR7JHjmWrQuwfs6vKKcprz3LLy3/CsDxH6NmO DnX9Qm9uGPSAhAPg0K56SUGuSxA+WkheI5qz9hRI9YW1TSdLt79xef3ChM7gqEw= =MqKS -----END PGP SIGNATURE----- --Sig_/bqP79W9lE9.IooexXALO8p5--