From owner-freebsd-questions@freebsd.org Wed Nov 8 16:37:39 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 9700DE57B5A for ; Wed, 8 Nov 2017 16:37:39 +0000 (UTC) (envelope-from luzar722@gmail.com) Received: from mail-io0-x22b.google.com (mail-io0-x22b.google.com [IPv6:2607:f8b0:4001:c06::22b]) (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 5B1CE80E18 for ; Wed, 8 Nov 2017 16:37:39 +0000 (UTC) (envelope-from luzar722@gmail.com) Received: by mail-io0-x22b.google.com with SMTP id f20so6571204ioj.9 for ; Wed, 08 Nov 2017 08:37:39 -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=LlaYgNbRvcDqh1OgmxJOCPdlNhhQygu8haEfMFSTtQM=; b=es/gUKjAoZKQ7SirBovfujRfABU+aApLFDM3H4g/SwZ/ZpJxkJaNyvpxuf/p5mkGWO jXxPl4R43HSBustKAebIVcHvIeewgRk69TKqblJwh8jQrzSuzUJWGUlCmvrZdgX2sKZO YWspAC0YTdKAB/bRVnzhYzNyeTBBWI2h3VBmoB4UtUioYbnOw18acwayDvfbUuXKF6GW d/6lTpW8TPItuJIQaXGM3bJSTA18PT0POLeuNa5HHbW8Hxuwye/L/nUOzrnsZOuix9M0 wTq0xuTo7LvC2uw4/lITm8XHimiwwz0lLivTMxzn8Gm1ikEotzwImW2FNkoxceqXCMpJ EaCg== 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=LlaYgNbRvcDqh1OgmxJOCPdlNhhQygu8haEfMFSTtQM=; b=o/AcJB1hv78azOLoYYZU5eGkSBJ70MLvACS4HSK5WqBEN/AjmHoHuxztgSiE+QSzb8 cBdGjJpUepVkWjxNGkajcGznfzKuTSc0hsfEJ5KYQFKqQN0v7GYUnRuSNZPvUXcjXV0f DOr/Z5ei4jPN5B2DhehmKoRPSxGUonJLkXQt3QQby3wXdFLkoBg+BXAL4R/UumDR/GkW dEBZiHmhS4OVddDZmx1cL6HpxrJN9JfPyfieIFunFvLe8yFvFaBLEU328/jm7P6/7mmR qLzb+egcAcBEQyknIWX0Sno203Zina8McricuVyezQmdtF4d/4Bm1czsaUOGWHaPm0tz cM3w== X-Gm-Message-State: AJaThX4HFD/Y7Hi8BviMSdaxXBHZzzjZVzLex0heb0eKWexwzPcWzKtj tXXgzf7b5GYwxHNsm6nBsgK0DA== X-Google-Smtp-Source: AGs4zMZ1evDmDpKjWPREUMeoo7i//NzKexgWdj9cwpcv//QUY4GnMCdvUJLUCnr+NMmgIuWC0Cq5qw== X-Received: by 10.107.12.233 with SMTP id 102mr1384369iom.227.1510159058646; Wed, 08 Nov 2017 08:37:38 -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 d1sm2342516iti.35.2017.11.08.08.37.36 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Nov 2017 08:37:37 -0800 (PST) Message-ID: <5A0332D1.90509@gmail.com> Date: Wed, 08 Nov 2017 11:37:37 -0500 From: Ernie Luzar User-Agent: Thunderbird 2.0.0.24 (Windows/20100228) MIME-Version: 1.0 To: Ian Smith CC: 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> In-Reply-To: <20171109005843.E72828@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: Wed, 08 Nov 2017 16:37:39 -0000 Ian Smith wrote: > On Tue, 7 Nov 2017 13:11:36 -0500, Ernie Luzar wrote: > > > Thanks Ian, > > Ending the while loop with "done &" worked. > > The one with or without the enclosing ( and ) to force a subshell? > > > When I issue dynip from the command line it runs as a daemon but I have to > > use the kill command to stop it. > > > > This is my rc.d script for dynip script. issuing "service dynip start" works > > but "service dynip stop" gives message saying > > dynip not running? (Check /var/run/dynip.pid). Well ps ax shows it is running > > and I have to use the kill command to stop it. > > Things to check: > > . after 'start' does /var/run/dynip.pid exist while it's running?? > . if so, does it contain the same PID as 'ps ax' shows for dynip? > . does 'ps ax' show a different PID for the subshell, if there is one? > . Does /var/run/dynip.pid still exist after running 'stop'? > > i.e. is the PID needed for kill the same as that in /var/run/dynip.pid? > > > Here is my rc.d script. What am I missing to populate the dynip.pid file so > > "service dynip stop" command will work? > > > > #!/bin/sh > > # > > # > > # PROVIDE: dynip > > # REQUIRE: LOGIN > > # KEYWORD: nojail shutdown > > # > > # Add the following line to /etc/rc.conf to enable dynip: > > # > > # dynip_enable="YES" > > # > > > > . /etc/rc.subr > > name="dynip" > > rcvar=dynip_enable > > command="/usr/local/sbin/${name}" > > pidfile="/var/run/${name}.pid" > > load_rc_config ${name} > > run_rc_command "$1" > > I've very little knowledge of the detailed behaviour of the rc system. > Let's see how the above questions might inform before speculating .. > > cheers, Ian > I tested with and without the enclosing ( and ) on the while loop and it made no difference. No pidfile exists before the "service dynip start" is issued and non exists afterwards.