From owner-freebsd-current@FreeBSD.ORG Sun Sep 7 15:44:27 2014 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 902DB81B; Sun, 7 Sep 2014 15:44:27 +0000 (UTC) Received: from mail-oa0-x229.google.com (mail-oa0-x229.google.com [IPv6:2607:f8b0:4003:c02::229]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4AA741481; Sun, 7 Sep 2014 15:44:27 +0000 (UTC) Received: by mail-oa0-f41.google.com with SMTP id i7so9968570oag.0 for ; Sun, 07 Sep 2014 08:44:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=LM1qR5GIwoDBOUH+1P4CDCSa/KGdPCG/pBPeME5/6xM=; b=iCsKoiw0ZPGtXKpp3UfuiIxXfqEFzOaCIXKKHpMynS6fx0mbpFOd0q97d2d+L9eawB iom7bBsGT/uOxJ8RHiw+qmWTpH7SZZTSSXLddrCHiZvwdndFUMlBsgS78/4HPGuECzXi 7D/+BrbhI0/OFXvWbV3xepuESyLTl8ORcStR5LZ/OWKWcuoTyEt0tjNNVfCpQpoySutp SMffEGWiDZ3vbPZVjL7akCCf8A9mTRhhY1h3FOFs4sYbAwPnc0GVk5PXxkbKKiA40Hi6 0d2lUHWPB3lJbZd5757xkxHxE7qysZhUcUrP20eNfTaEGV2FkNbqIAL/BFqzUSt3aJrD Z+4A== MIME-Version: 1.0 X-Received: by 10.182.129.230 with SMTP id nz6mr26537317obb.16.1410104666494; Sun, 07 Sep 2014 08:44:26 -0700 (PDT) Received: by 10.202.176.4 with HTTP; Sun, 7 Sep 2014 08:44:26 -0700 (PDT) In-Reply-To: <20140907112811.5570fc85.ohartman@zedat.fu-berlin.de> 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> Date: Sun, 7 Sep 2014 10:44:26 -0500 Message-ID: Subject: Re: service doen't get started at boottime, but can start manually From: Scot Hetzel To: "O. Hartmann" Content-Type: text/plain; charset=ISO-8859-1 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 15:44:27 -0000 On Sun, Sep 7, 2014 at 4:28 AM, O. Hartmann wrote: > Am Sun, 7 Sep 2014 04:03:25 -0500 > Scot Hetzel schrieb: > >> On Sun, Sep 7, 2014 at 3:39 AM, Scot Hetzel wrote: >> > I had a look at scripts/refdb.in, it is not a proper rc script for >> > FreeBSD, as it is missing several keywords: >> > >> > # PROVIDE: <- all scripts need this >> > # REQUIRE: >> > # BEFORE: >> > # KEYWORD: <- optional >> > >> > Which tells rcorder where to put refdb in the startup order. Since >> > these are missing, rcorder doesn't place it in the startup list. >> > >> I looked again, and it is not rcorder, it's /etc/rc and /etc/rc.subr >> that determine which script to run. >> >> /etc/rc calls find_local_scripts_new from /etc/rc.subr. >> find_local_scripts_new checks each rc script to make sure that they >> have at least a "# PROVIDE: " keyword. If it does, then it adds that >> script to ${local_rc}. Then /etc/rc runs: >> >> files=`rcorder /etc/rc.d/* ${local_rc}` >> >> to get the startup order for these scripts. Then /etc/rc starts the >> scripts in the proper order. >> >> Since, /usr/local/etc/rc.d/refdb{,.sh.dist} is missing the "# PROVIDE: >> ", the script is skipped on startup. >> >> Since, rc.d/refdb is not a proper rc script, adding refdb_enable=YES >> to /etc/rc.conf{,.local} will not control the starting of this script. >> >> Someone should fix service, so that it checks the rc script has a "# >> PROVIDE: ", and displays an error message if it doesn't. > > Hello Scott, > > as the new maintainer of this port, I'm working on a solution, but first, I have to > understand the way this obscure rc-script system works. Thanks for your good explanation. > I tried to put PROVIDE/REQUIRE in the script, but I also changed refdb.sh -> refdb > which, in the end, didn't work. The service IS started with refdb.sh in rc.d/. > > Since the original refdb.sh init script targets both Linux and *BSD and delegates the > starting, stopping et cetera to a script called refdbctl, the latter script needs to be > examinded and as far as I understand, most of its functionality is covered > by /etc/rc.cubr, except the part where refdbctl searches for the path of the PID file and > replaces the init/default path its configuration counterpart found in > /etc/refdb/refdbdrc. > > I guess, at the end FreeBSD doen't need the templated refdbctl/refdb.in (to be found in > the sources in scripts/). > > If you'd like to have a look at it, I can send you the sekelton I've already prepared for > the refurbishment of the port. > 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" 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. -- DISCLAIMER: No electrons were maimed while sending this message. Only slightly bruised.