Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Aug 2019 22:37:42 +0300
From:      Andriy Gapon <avg@FreeBSD.org>
To:        Freddie Cash <fjwcash@gmail.com>
Cc:        Warner Losh <imp@bsdimp.com>, "Rodney W. Grimes" <freebsd-rwg@gndrsh.dnsmgr.net>, FreeBSD-Current <freebsd-current@freebsd.org>, freebsd-rc@freebsd.org
Subject:   Re: rc script: manual stop vs system shutdown
Message-ID:  <9b9ca0a6-5aee-74c7-2ac0-a70a81d72593@FreeBSD.org>
In-Reply-To: <CAOjFWZ40Aivdod_BqYzOcjKZH6sBC2iYTAVre4ED%2BW1z906Eyg@mail.gmail.com>
References:  <2e50fb67-8a19-412b-19d2-14f5f20b61f8@FreeBSD.org> <201908011553.x71FrTCd060252@gndrsh.dnsmgr.net> <CANCZdfpuEuRKMPKTKJkzUg4mwugCV5iUxEEEV0yt%2BZTceZf1dg@mail.gmail.com> <d885a84a-d57c-03b4-72e5-9f37950cfa8e@FreeBSD.org> <CAOjFWZ40Aivdod_BqYzOcjKZH6sBC2iYTAVre4ED%2BW1z906Eyg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 01/08/2019 21:53, Freddie Cash wrote:
> On Thu, Aug 1, 2019, 11:15 AM Andriy Gapon, <avg@freebsd.org
> <mailto:avg@freebsd.org>> wrote:
> 
>     On 01/08/2019 19:12, Warner Losh wrote:
>     >
>     >
>     > On Thu, Aug 1, 2019, 10:53 AM Rodney W. Grimes
>     > <freebsd-rwg@gndrsh.dnsmgr.net
>     <mailto:freebsd-rwg@gndrsh.dnsmgr.net>
>     <mailto:freebsd-rwg@gndrsh.dnsmgr.net
>     <mailto:freebsd-rwg@gndrsh.dnsmgr.net>>>
>     > wrote:
>     >
>     >     >
>     >     > Is it possible in an rc script to distinguish between a
>     manual stop
>     >     > (e.g., service foo stop) and a stop during a system shutdown
>     (via
>     >     > rc.shutdown) ?
>     >     > Are there any marker variables for that?
>     >     > Or something in the global system state?
>     >
>     >     Not that I can think of, but I like this idea,
>     >     I am sure that use cases exist.
>     >
>     >
>     > What is the use case that needs to disambiguate the two cases...
> 
>     I have one use case in mind and it's a truly special case.
>     I want rc.d/watchdogd to gracefully stop watchdogd and to disable the
>     watchdog timer when the stop action is requested manually.  And I want
>     it to stop watchdogd and set the watchdog timer to a special shutdown
>     timeout during the shutdown.  If the special timeout is configured, of
>     course.
> 
> 
> A horribly hackish workaround could be to do a "pgrep shutdown" and
> "pgrep reboot" and "pgrep halt" in the stop function of the RC script.
> If one of those those processes exist, then a system shutdown/reboot is
> in progress.
> 
> Not elegant, but could be workable until something nicer is added.

I think that shutdown by default sends a signal to init and exits.
It's init that kicks off rc.shutdown.


-- 
Andriy Gapon



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9b9ca0a6-5aee-74c7-2ac0-a70a81d72593>