From owner-freebsd-questions@freebsd.org Thu Nov 9 18:20:17 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 5671BE58069 for ; Thu, 9 Nov 2017 18:20:17 +0000 (UTC) (envelope-from kraduk@gmail.com) Received: from mail-qt0-x22e.google.com (mail-qt0-x22e.google.com [IPv6:2607:f8b0:400d:c0d::22e]) (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 0CFD3724DA for ; Thu, 9 Nov 2017 18:20:17 +0000 (UTC) (envelope-from kraduk@gmail.com) Received: by mail-qt0-x22e.google.com with SMTP id 8so8823947qtv.1 for ; Thu, 09 Nov 2017 10:20:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=MwLvpD/UKuCUnxz6fFtihhI7DTk6u3PpIIoIOpdhbTA=; b=c+0uQeAYX5Rck1zsVTutLoDygfUoTuw9CauHwTUkZQoSyeBQ24fyK3jehjY+bllPLy w5TqNol7e2sKoGyoPzN996sxU30oTsoI/1gDpem3RRCvvLxlKplVhBPZdcdHolfgdSJL 0Wk95oly7PxBL7giKM+N1zkKGzi1Z63uMmLyDj2jbnu2PI/mBcoH7/DR1BPf7LGtcQeh 9nkBmLG2/OLoFWNc6/K99PdTp9AXZTcqIrJJeevqJ15B0Xp0K+LwcUp1xctQ5QhqXLoS EAS22tkWqreqe4yhcTNu7l86yZlRD1lp2PRCAYPl/StnUZjvVhjIs3MCPiM0OFN+7tbV Aitw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=MwLvpD/UKuCUnxz6fFtihhI7DTk6u3PpIIoIOpdhbTA=; b=TojX9+vrATjLQB2dnE4vMfup6Slc1/MzAM5Pz/xHvJZk6KFFZu8QpXX0Z8L4PiwPr0 MIpSVgEfqXO9Ya8DZeuBkllQ3LfuPGOOsjyWldHAWDyhhDIRI/ijaWFUKXdBF1tlFs/b CXS9vMqABYRCuqL3fL9GE3EW48EeLml9sxqegV/8zUN71COICpX+Ep0alPOFb/DnjkYR vtX2oqSvxux/i0k6fSKBwkNWOa1nRIAa1QjgxBtLA3b+08sGo16dRUj76pX4JfMv6Bqa HabxySYIDbqEzYqBaivdLTDF4wgJC45j8OP7rdxbExHBtuLvg4+wEQ/ZHN99GXZAYyMw IwrQ== X-Gm-Message-State: AJaThX7StMMWEymJ+LzS5p3k+Ce9voYPKV/E84iz4evOHdObHI5jjMH3 dQD+7ReYsdULp/5bUV6h7xOOmEJKsOdPDW94wgo= X-Google-Smtp-Source: AGs4zMbHEpJrJAi2RfczPYWPr5e04zVEaqdxaxuBqNgLahNV2xKy/F94LCoAUGvFwrlLRNdnTezJOiVwzM+4M3tAI4w= X-Received: by 10.200.6.136 with SMTP id f8mr2384938qth.265.1510251616219; Thu, 09 Nov 2017 10:20:16 -0800 (PST) MIME-Version: 1.0 Received: by 10.140.20.65 with HTTP; Thu, 9 Nov 2017 10:20:15 -0800 (PST) In-Reply-To: <5A0481AE.7050504@gmail.com> References: <20171108021900.W9710@sola.nimnet.asn.au> <5A0481AE.7050504@gmail.com> From: krad Date: Thu, 9 Nov 2017 18:20:15 +0000 Message-ID: Subject: Re: Need help with rc.d script To: Ernie Luzar Cc: Ian Smith , FreeBSD Questions , Polytropon , edgar Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.23 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 18:20:17 -0000 I try to write things that work 8) On 9 November 2017 at 16:26, Ernie Luzar wrote: > 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 > > >