From owner-freebsd-questions@FreeBSD.ORG Sat Aug 5 08:06:17 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8254016A4DE for ; Sat, 5 Aug 2006 08:06:17 +0000 (UTC) (envelope-from smithi@nimnet.asn.au) Received: from gaia.nimnet.asn.au (nimbin.lnk.telstra.net [139.130.45.143]) by mx1.FreeBSD.org (Postfix) with ESMTP id BC21143D6A for ; Sat, 5 Aug 2006 08:06:08 +0000 (GMT) (envelope-from smithi@nimnet.asn.au) Received: from localhost (smithi@localhost) by gaia.nimnet.asn.au (8.8.8/8.8.8R1.4) with SMTP id SAA12086; Sat, 5 Aug 2006 18:05:35 +1000 (EST) (envelope-from smithi@nimnet.asn.au) Date: Sat, 5 Aug 2006 18:05:34 +1000 (EST) From: Ian Smith To: Svein Halvor Halvorsen In-Reply-To: <20060804221559.A259F16A4FF@hub.freebsd.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Cc: DW , freebsd-questions@freebsd.org Subject: Re: .bash_logout and shutdown -- need ideas X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Aug 2006 08:06:17 -0000 On Fri, 4 Aug 2006 freebsd-questions-request@freebsd.org wrote: > Message: 5 > Date: Fri, 04 Aug 2006 19:38:12 +0200 > From: Svein Halvor Halvorsen > Subject: Re: .bash_logout and shutdown -- need ideas > To: DW > Cc: freebsd-questions@freebsd.org > Message-ID: <44D38604.6020500@lvor.halvorsen.cc> > Content-Type: text/plain; charset="iso-8859-1" > > DW wrote: > > Just started using a .bash_logout script to handle doing my unison > : > > The problem with that though, is that the shutdown process runs as root, > > and just drops the system, and I'm never actually getting logged out as > > much as booted out. So my .bash_logout doesn't run, and thus no unison > > unless I remember to run it manually first. > > > > Any ideas on how to work around this sitch? > > > At shutdown FreeBSD runs /etc/rc.shutdown. It seems that this script, by > means of /etc/rc.subr, will iterate all the files in (among others) > /usr/local/etc/rc.d/ and call them with the "faststop" argument. > > Maybe you could just add a script in there? > > (Actually, only files with a "# PROVIDES" line are considered, it seems, > so you should think about that). Also, DW was running 'sudo shutdown -p now' which is indeed immediate .. 'shutdown -p +1' (say) sets the shutdown countdown to one minute, makes (w)all sorts of noise then and again at (as I recall) 30 seconds to zero, plenty of time to logout from other things and (auto)run any other scripts you like before the shutdown-initiated rc.shutdown stuff. Furthermore, if you change your mind you've got time to kill shutdown itself before the timeout. 'sudo killall shutdown' should do the trick. Cheers, Ian