rc script: manual stop vs system shutdown

Rodney W. Grimes freebsd-rwg at gndrsh.dnsmgr.net
Thu Aug 1 17:39:56 UTC 2019


> On Aug 1, 2019, at 08:53, Rodney W. Grimes <freebsd-rwg at 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?

-- 
Rod Grimes                                                 rgrimes at freebsd.org


More information about the freebsd-rc mailing list