From owner-freebsd-questions@freebsd.org Fri Nov 10 15:50:05 2017 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1A878E70B8A for ; Fri, 10 Nov 2017 15:50:05 +0000 (UTC) (envelope-from luzar722@gmail.com) Received: from mail-it0-x229.google.com (mail-it0-x229.google.com [IPv6:2607:f8b0:4001:c0b::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D10147899E for ; Fri, 10 Nov 2017 15:50:04 +0000 (UTC) (envelope-from luzar722@gmail.com) Received: by mail-it0-x229.google.com with SMTP id j140so2155425itj.1 for ; Fri, 10 Nov 2017 07:50:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-transfer-encoding; bh=nZHRbjEALF4QfdjvDex0V5K7jGGWtyWTb6n+bFUVePU=; b=mhJae3c9SkNW0UK1juDtU+vrkVqqblMXkUYUYO7xB9HvbXZQNdmeKzSK7kxDMqkUQo 07+wvdCnRihmCWJCVojuhFk0Sz7yi/d0GFrV4yoyLISozJhRXuXa5E//HwNmLwAL2fR8 eiU+cr6B5tCl4+20lJpcWs4lUz3Kf2kpTRi1xEZU4cYq7IPcT1f+yy1PUCfOjd321KBJ HM+uSchMqVXMMyaIBszwo+U+n/lDUOZx4fMhx2gChM497P8nz8Xnjk5tiG6w0gfnWjdC wt0YxDX+P+62rySi/EHHJ7DY9MAW8iiukH6IQf5DmDimWNGNLWJnRjAwB5z/PTWyp0MC /tqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-transfer-encoding; bh=nZHRbjEALF4QfdjvDex0V5K7jGGWtyWTb6n+bFUVePU=; b=bjEL67XmMdmZ7HPGv1efOFXjb8IS6U1JehvZJpNnyqvrQJwb8Un752/BnkPheWHIjh ooH7MjfzhV9rLIGD2zqu/3EpJFC3ozhQYtkvxzbWw0sRHUtQlfcPC3JUx8S2t2ask48h 0Sw1dMEBd9dtWnmtLDUBjsOf8YNiZUJeY1oXzvw25S1IvA+UvoNJefbndDq624m+HkXW l4I3Dh6R0GO+OfObs5z2rs5SJl7XmHvYcZgx1Ebafb/DU2Qa2RJz8EiCunuNbqs03fMb 2ezGft4qj0sYuBHwKhWPlc1Y+NZUO54rtdd88AFmdSdyWAc5HJgQ0zTqrQymSR92Bozo 0K1w== X-Gm-Message-State: AJaThX7239G9Vext1RwQse66E3VcGGXly2B/uCYo47aen/rIeGC0SG50 VTE/QATznLB5GcIFW9NbpcQ= X-Google-Smtp-Source: AGs4zMb0WigB6wCUVivGPyytKJiwEjZr8RFrbY5HukWEfb75MQKN1cgnPu3kIW+fAKAR+/+M+5lBHQ== X-Received: by 10.36.253.73 with SMTP id m70mr950717ith.49.1510329004290; Fri, 10 Nov 2017 07:50:04 -0800 (PST) Received: from [10.0.10.7] (cpe-65-25-50-122.neo.res.rr.com. [65.25.50.122]) by smtp.googlemail.com with ESMTPSA id c10sm1052113itc.39.2017.11.10.07.50.02 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 10 Nov 2017 07:50:03 -0800 (PST) Message-ID: <5A05CAA8.8040607@gmail.com> Date: Fri, 10 Nov 2017 10:50:00 -0500 From: Ernie Luzar User-Agent: Thunderbird 2.0.0.24 (Windows/20100228) MIME-Version: 1.0 To: Ian Smith CC: krad , FreeBSD Questions , Polytropon , edgar Subject: Re: Need help with rc.d script References: <20171108021900.W9710@sola.nimnet.asn.au> <5A0481AE.7050504@gmail.com> <20171110211228.O72828@sola.nimnet.asn.au> In-Reply-To: <20171110211228.O72828@sola.nimnet.asn.au> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Nov 2017 15:50:05 -0000 As I review the different methods tried to make my simple sh script function using the rc.d framework seems to resulted in 2 different methods coming to light. Method 1. Use of the daemon command in the rc.d script. This is the method we ended up getting to work. It needed no special codding in the base script IE: ( ... ), &, or the creation and or population of the scripts running pid file. Method 2. The use of the rc.d framework defaults which we were never able to get working. Speculation about the base script needing special codding IE: ( ... ), &, or the creation and or population of the scripts running pid file. This method is used by most all the ports that use the rc.d framework. So I ask the question, why could we NOT get method 2 working. I am of the opinion that both methods should have worked. Are we missing something so obvious that its staring us in the face and we can not see it. The handbook rc.d section does not point out any difference in handling scripts or compiled programs, or anything about the pid file having to be manually manipulated. The result meaning from reading the handbook rc.d section is the rc.d framework is designed to automatically handle the pid file manipulation. If this is really not ture, then the handbook rc.d section has very large hole in its documentation. I believe we should continual working on getting method 2 working so we all learn how rc.d really works and if need be submit a update to the handbook rc.d documentation to give the reader a clearer picture of what needs to be done to use the rc.d framework for a sh script. https://www.freebsd.org/doc/en_US.ISO8859-1/articles/rc-scripting/rcng-daemon.html This talks about setting the command_interpreter variable for executable scripts. I tested using the testloop rc.d script posted previously with command_interpreter="/bin/sh" and a second time with command_interpreter="sh" and in both cases no pid file was created. Our combined knowledge and experience has so far not been able to come up with a solution to use the default rc.d framework to start a normal executable sh script as a daemon without using the daemon command explicitly. I think it is time to draw on other people in the community who we may know who has more rc.d experience to assess us. If you have someone in mind please email this post to them so they can read the complete thread and hopefully come up with an answer. Other reading I have done. https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/configtuning-rcd.html https://www.freebsd.org/doc/en/books/porters-handbook/rc-scripts.html https://www.freebsd.org/doc/en_US.ISO8859-1/articles/rc-scripting/ http://www.mewburn.net/luke/papers/rc.d.pdf