From owner-freebsd-questions@freebsd.org Thu Nov 9 15:18:32 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 2CB51E534AA for ; Thu, 9 Nov 2017 15:18:32 +0000 (UTC) (envelope-from luzar722@gmail.com) Received: from mail-io0-x22f.google.com (mail-io0-x22f.google.com [IPv6:2607:f8b0:4001:c06::22f]) (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 E1C546A9F0 for ; Thu, 9 Nov 2017 15:18:31 +0000 (UTC) (envelope-from luzar722@gmail.com) Received: by mail-io0-x22f.google.com with SMTP id d66so10204546ioe.5 for ; Thu, 09 Nov 2017 07:18:31 -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=YUeRk/6asTZYdJ8RWajpp7g24h9b3NmCaVwmE+0Pktg=; b=O+MsMJOlCiePBHTAQMZnBkD+Wc6IL4hsnvSQvz6cpyCce3Ls10o3Ty1p5t48M++rMA 1o2ngG3oJeEvBxp7BPPiWVDVDVQ6u6AAq3MMbXPDdf3QmYbMP8HAVxdaUqPkqPTqT3z8 lh2SoqpYwxeK3tUWwIF71lS1WzjBQyulhq6FGgQ6Sjp2DMc125Tjadqb936tp2BZLCtl CLmkLeoY/Q/Hge9nMIziL4RVm37sY0B/+mweKhfTKbl7MFeo+NGps3V3MPvuMdXwNQxH LoI0qSGhHAQ+LVDhR9y7+u4dy+VNdGFGcjH3mwDzI+FSL/tx2Sw5lFs/c+beBKfqQbN5 u7tg== 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=YUeRk/6asTZYdJ8RWajpp7g24h9b3NmCaVwmE+0Pktg=; b=I9SxWTzOsuezNX+6/FPIyhAID4iVwqEpk0UaGuoKj3mD9gYo561ANZ5BtHEawYzLe+ S8HSkUwZm6FD7k56VYhmKL50CG5x3mYQ7e0JZSVIyYKshnOWoeTYiTbcmRD4IojKK7SK y8rOf8CRujuwO5YjpA5FgT872wlAReaDrRJC7xgeZmgi540QeKlMZ0wP5u7ZWlrEEZpe VTxKzMrD7vbC34ru9Y2EVT+WLCyfGHGvmIDP7nBKM5FZ1SZaWCH/jIzXZGu1k54SroKQ 0rfr2YD4NVT9zfYZED0eCgov0O7DC1wGr0rVZWB3fjtZQfaYxftAo25iesCc+9vsLuSG hWuQ== X-Gm-Message-State: AJaThX6CqOjPXh2EXAi2JdWVb3ryn318N+1WBfZigHEEDacHiL3/HlsY DOHC41u9jH0Ij9b0N6TK27Ay0A== X-Google-Smtp-Source: AGs4zMbJMzzxbpHauleSgdnQv+FbIP90O1Sm8ICkmbAKuDKhH8O9q1UKXSSZOvjUIqv7wUh0/L59yw== X-Received: by 10.107.7.156 with SMTP id g28mr1065544ioi.38.1510240711323; Thu, 09 Nov 2017 07:18:31 -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 e68sm1421418ite.0.2017.11.09.07.18.30 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 09 Nov 2017 07:18:30 -0800 (PST) Message-ID: <5A0471C8.8010409@gmail.com> Date: Thu, 09 Nov 2017 10:18:32 -0500 From: Ernie Luzar User-Agent: Thunderbird 2.0.0.24 (Windows/20100228) MIME-Version: 1.0 To: =?ISO-8859-1?Q?Trond_Endrest=F8l?= CC: FreeBSD questions 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> <5A046C46.4020807@gmail.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit 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 15:18:32 -0000 Trond Endrestøl wrote: > On Thu, 9 Nov 2017 09:55-0500, Ernie Luzar wrote: > >> 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 > > Shouldn't this be /var/run/testloop.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" > > Or maybe you should name this dynip? > >> 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. > yep echo $! > /var/run/dynip.pid should be echo $! > /var/run/testloop.pid service testloop onestart now creates the pid file with the correct task number, but service testloop onestop still complains about no pid file.