Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Jul 2013 14:35:56 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-mobile@freebsd.org
Cc:        "Julian H. Stacey" <jhs@berklix.com>, Jilles Tjoelker <jilles@stack.nl>
Subject:   Re: Adding a hook to shutdown.c & halt (reboot.c) to call a script.
Message-ID:  <201307101435.56193.jhb@freebsd.org>
In-Reply-To: <201307052235.r65MZ27H028531@fire.js.berklix.net>
References:  <201307052235.r65MZ27H028531@fire.js.berklix.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Friday, July 05, 2013 6:35:02 pm Julian H. Stacey wrote:
> > shutdown(8) signals init (unless -o is given), which will run
> > /etc/rc.shutdown from multi-user mode. The same applies to ctrl+alt+del,
> > kernel-controlled overheating shutdown, etc.
> 
> Thanks Jilles, So I appended to my rc.shutdown
> 	# -x not -f below to also allow a symbolic link to work.
> 	if [ -x "/etc/rc.shutmedia" ]; then
> 		/etc/rc.shutmedia
> & renamed my URL to  http://www.berklix.com/~jhs/bin/.sh/rc.shutmedia
> 
> 
> > reboot(8) and halt(8) do not involve init and do not run any shutdown
> > scripts. I think they should be changed to signal init (except reboot
> > -q, halt -q) and should not be used until then. However, there are
> > apparently some problems with that.
> > 
> > The incorrect umount order should perhaps be fixed in the kernel.
> 
> Yes, bad enough for a local laptop to hang, 
> if it was a remote server, very nasty.

You can just put a script in /usr/local/etc/rc.d.  If it has the
'shutdown' keyword it gets run with a 'stop' command during shutdown.

(Just grep for "shutdown" in /etc/rc.d to find example scripts)

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201307101435.56193.jhb>