Date: Thu, 1 Aug 2019 21:09:18 +0300 From: Andriy Gapon <avg@FreeBSD.org> To: "Rodney W. Grimes" <freebsd-rwg@gndrsh.dnsmgr.net>, Enji Cooper <yaneurabeya@gmail.com> Cc: freebsd-rc@freebsd.org, FreeBSD Current <freebsd-current@freebsd.org> Subject: Re: rc script: manual stop vs system shutdown Message-ID: <a3d6e945-a557-733c-50bd-fe48c95110c8@FreeBSD.org> In-Reply-To: <201908011739.x71Hdrfh060807@gndrsh.dnsmgr.net> References: <201908011739.x71Hdrfh060807@gndrsh.dnsmgr.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On 01/08/2019 20:39, Rodney W. Grimes wrote: >> On Aug 1, 2019, at 08:53, Rodney W. Grimes <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. >> >> Have you looked at: >> keyword: shutdown >> etc? > > Well that does indeed seem to wipe out my > "Not that I can think of". So infact an rc script > can tell, it is invoked as: > > /etc/rc.d/foo shutdown > during a system shutdown > > vs > > /etc/rc.d/foo stop > when invoked by service foo stop? > > Is that correct? > Except there is no 'foo shutdown'. It's foo stop in both cases. To be pedantic, it's foo faststop for shutdown, but that can be manually invoked as well. -- Andriy Gapon
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?a3d6e945-a557-733c-50bd-fe48c95110c8>