From owner-freebsd-questions@freebsd.org Thu Nov 9 14:55: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 01CE0E524FD for ; Thu, 9 Nov 2017 14:55:05 +0000 (UTC) (envelope-from luzar722@gmail.com) Received: from mail-it0-x234.google.com (mail-it0-x234.google.com [IPv6:2607:f8b0:4001:c0b::234]) (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 B7D2F69658 for ; Thu, 9 Nov 2017 14:55:04 +0000 (UTC) (envelope-from luzar722@gmail.com) Received: by mail-it0-x234.google.com with SMTP id 72so11569476itl.5 for ; Thu, 09 Nov 2017 06:55: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=NYa6+6Q3iOvf1dGkuWYBURwgUxyV+0/hDuZag4cBYr8=; b=YEtSEX0aqFNbbVxaNs7utxBF7No/i0k+6HIwxTlz0XYSC6hkl+AeLDpbF4E3faFeOU KfH6qMI/AS0ZdGhFDTb7UuOz8tTYdAgtxZE3YeBmuGxr/BiHUoPQurp/GuBAWM/l5Vsn MKeSRU6ULCQNtIDY9uaVdemqfnMwmFjjM4WfdInU1Z/vtcI2bY4KIor1OZPv8QMpZPgR ojA41dnLn71mjWm9jdzXRIq+vjLOSYyt0fgQG+ReyjhhJ5RDZqZYRor1WbfS9vwrF04i t9eahoYWFIsR1fgQiBumYSgqUflS3DBpofu4ym4o1EMXk7NUYq8rJarIHreE5AZltWYr mg6A== 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=NYa6+6Q3iOvf1dGkuWYBURwgUxyV+0/hDuZag4cBYr8=; b=P9dV3CjPO2+5PrDW8irwrdEU2eGS9eTp3Pu91oIN34x/ORsqzg/5ru5+wk/XNAnf3e v92Hejp1OVxdBz4pjvPhtjzQH+ElIZBmbfu5+cae8JCwuD2qgKZgY9qL+nKzoKWOuCRF ofhp05m5saHhtEpVkw5jf0KRVO0NCBz3ECBNGTtIx/LyrxpLZ0WBuSlfhZu3nlN/a0PE o6ON+PPdWLxzJvsqjSVzkNJbpXtqCHW4u6nCwaUFYqis2CWy1KAwp1utJ04ylfbTaDRY 69Tw1KKW40gsMS6jcIT8OMFyZqVVc+sTirgHIdPaganRqURskDjzE2jaFqKcFkHvtcKi Qpww== X-Gm-Message-State: AJaThX6+CYUWFZZu2+TndPcSUyiogQkFmnFs8adp4e6et5OoqDrrUqBq Ae6gmzmrhnzdjPE52JE8RDfFeA== X-Google-Smtp-Source: AGs4zMar3xEwwBzn4hzxZlnSruQUGvWKCfSiOd1OqVikFbtB7AFtxEokiC6pTSKTQ7f/gnsPqOyzFA== X-Received: by 10.36.83.137 with SMTP id n131mr211153itb.82.1510239304110; Thu, 09 Nov 2017 06:55: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 j71sm1234342itj.2.2017.11.09.06.55.03 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 09 Nov 2017 06:55:03 -0800 (PST) Message-ID: <5A046C46.4020807@gmail.com> Date: Thu, 09 Nov 2017 09:55:02 -0500 From: Ernie Luzar User-Agent: Thunderbird 2.0.0.24 (Windows/20100228) MIME-Version: 1.0 To: Ian Smith CC: Polytropon , Edgar Pettijohn , freebsd-questions@freebsd.org Subject: Re: Need help with rc.d script References: <20171108021900.W9710@sola.nimnet.asn.au> <20171108043726.N72828@sola.nimnet.asn.au> <5A01F758.1050706@gmail.com> <20171109005843.E72828@sola.nimnet.asn.au> <5A0332D1.90509@gmail.com> <20171109013818.GA31584@FreeBSD> <20171109040452.d3c25fe2.freebsd@edvax.de> <20171109185331.B72828@sola.nimnet.asn.au> In-Reply-To: <20171109185331.B72828@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: Thu, 09 Nov 2017 14:55:05 -0000 Thanks for everyones input. But still the service stop command can not find the pid file. In a effort for everyone to play with this problem on their own computers I have simplified things as shown below. >cat /usr/local/sbin/testloop #!/bin/sh ( while true; do echo -e "Success:" logger -t testloop -p daemon.err "Success: log" sleep 10 done ) & echo $! > /var/run/dynip.pid exit 0 The above is what Iam said to try. >cat /usr/local/etc/rc.d/testloop #!/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/local/sbin/${name}" load_rc_config ${name} run_rc_command "$1" service testloop onestart does indeed start testloop as a daemon. Can verify that by using the ps command. But there is no /var/run/testloop.pid created, and the service testloop onestop command still complains about it not running no pid file.