From owner-freebsd-questions@freebsd.org Thu Nov 9 16:26:22 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 71914E55289 for ; Thu, 9 Nov 2017 16:26:22 +0000 (UTC) (envelope-from luzar722@gmail.com) Received: from mail-io0-x242.google.com (mail-io0-x242.google.com [IPv6:2607:f8b0:4001:c06::242]) (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 3471A6E2FF for ; Thu, 9 Nov 2017 16:26:22 +0000 (UTC) (envelope-from luzar722@gmail.com) Received: by mail-io0-x242.google.com with SMTP id p186so10428039ioe.12 for ; Thu, 09 Nov 2017 08:26:22 -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=ZnHOlyRTAyZiWc28BMPhUllHP+xE7InJ48lEcchoXLg=; b=KfiqecT/eMYRDj/B8wUOVV0vbLeLxeJSrW7PaePCdpJF+SjsckR96hxdvLzrGDthJ+ wOFeWpkUyHb2F8Lw8jFFJ8lvlriRfyJwgm1REvbWPNFSb2xHjAap/izKwa8vssLFOdBR XafSM6G6xGAlBUod7XJYM+NznmdFs0z9j8kUGrX/u9tVuw32h9KltGeW8d5gFzFfcsMA HdTiiXAC8A5udPYbntmz6BDjE1ZvELY46esy5LPdGNT80hRlUgRgFpe6APbBC91XPKPO mQz78o63VQmx+o612KA8Z1YL4IliiEK+GctguM+1xP7cSq42KwX6W4SP5x42zTf2zIRV P0GQ== 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=ZnHOlyRTAyZiWc28BMPhUllHP+xE7InJ48lEcchoXLg=; b=MWW+ZuBZU7XGpWyKZUyol7zoPuuIcPoiX48MtITRxX2rqs2nvAEgp5LL4er8CKKHRT J3XL1XPRTduQJ0dZSApTmEq4/sQaYP1awL/Zq8e3M650XE1rTodQb2TBFR+gAQiymaAL 2HeVUTEA5ZVF7v2cZ8KHQMRyukCDnQrsalTwDSfQFfrtAn2HzG36HpFCgTLD/OhrKyWR 1mrOYt0j3BqwgjSlcOqXTmZ723OIcTr1bI9rncXMP7VkMDNbjGAxKBTK93SFkHYrv7w7 dQdVWDYdBtAMsXnd9WewBnQQmzXaXorSAZ9u0sxaLY4MJPogjsFRhI1g7ecFZnM1y/99 4AMw== X-Gm-Message-State: AJaThX4G6/yEQiVRrS97M/nPysObfUGdUbHLyUzF4xYDCD5K3GLMw541 BnNrJeaTysIezq1tV5Y07aw= X-Google-Smtp-Source: ABhQp+QRJO+unVjpzg0YMA6gJYL4Olp3BsDhpjAjlg54Tdav20kNrfuBopzJuE3ph+UhJYZ1AGyVwA== X-Received: by 10.107.16.162 with SMTP id 34mr1216207ioq.169.1510244781572; Thu, 09 Nov 2017 08:26:21 -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 196sm3589385ioe.66.2017.11.09.08.26.20 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 09 Nov 2017 08:26:21 -0800 (PST) Message-ID: <5A0481AE.7050504@gmail.com> Date: Thu, 09 Nov 2017 11:26:22 -0500 From: Ernie Luzar User-Agent: Thunderbird 2.0.0.24 (Windows/20100228) MIME-Version: 1.0 To: krad CC: Ian Smith , FreeBSD Questions , Polytropon , edgar Subject: Re: Need help with rc.d script References: <20171108021900.W9710@sola.nimnet.asn.au> In-Reply-To: Content-Type: text/plain; charset=UTF-8; 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: Thu, 09 Nov 2017 16:26:22 -0000 krad wrote: > true, but it will probably handle it better, unless you reinvent the > wheel, and it is part of the base OS > Here Krad is talking about using the daemon command. I had tried this before without any joy. So I gave it another try based on the script he provided. It worked, much joy. This is the working testloop scripts, >cat /usr/local/etc/rc.d/testloop.daemon #!/bin/sh # # # PROVIDE: testloop # REQUIRE: LOGIN DAEMON NETWORKING # KEYWORD: nojail shutdown # # Add the following line to /etc/rc.conf to enable testloop: # # testloop_enable="YES" # . /etc/rc.subr name="testloop" rcvar=testloop_enable pidfile="/var/run/${name}.pid" command="/usr/sbin/daemon" load_rc_config ${name} command_args="-P ${pidfile} /usr/local/sbin/${name}" run_rc_command "$1" >cat /usr/local/sbin/testloop #!/bin/sh while true; do echo -e "Success:" logger -t testloop -p daemon.err "Success: log" sleep 10 done exit 0