Date: Sun, 7 Sep 2014 21:23:22 +0200 From: "O. Hartmann" <ohartman@zedat.fu-berlin.de> To: Scot Hetzel <swhetzel@gmail.com> Cc: FreeBSD CURRENT <freebsd-current@freebsd.org>, FreeBSD Ports <freebsd-ports@freebsd.org>, Erich Dollansky <erich@alogt.com> 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: <CACdU%2Bf8eYF_HbwqOq0RoC4dq_mG1io5LYfafyipzMn-EzVq9xA@mail.gmail.com> References: <20140907090321.12bbc428.ohartman@zedat.fu-berlin.de> <20140907153342.2366ad8b@X220.alogt.com> <20140907094308.6c466d9f.ohartman@zedat.fu-berlin.de> <CACdU%2Bf_%2BB353Hyv2cHir=Jp53MZoKsFeu4i=spDKEAgsjHmcVQ@mail.gmail.com> <CACdU%2Bf_fby%2BKUUWTEDJrcPSdTdYNx=c2-WMG-pP%2BeR8peuXwiQ@mail.gmail.com> <20140907112811.5570fc85.ohartman@zedat.fu-berlin.de> <CACdU%2Bf-w4v_8ebe=VsEJn9f4pu_MGdOfugjeL=Wkpyp6PE=TWg@mail.gmail.com> <CACdU%2Bf8eYF_HbwqOq0RoC4dq_mG1io5LYfafyipzMn-EzVq9xA@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--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 <swhetzel@gmail.com> schrieb: > On Sun, Sep 7, 2014 at 10:44 AM, Scot Hetzel <swhetzel@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=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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140907212322.4f2d370f.ohartman>