From owner-freebsd-questions Tue Aug 29 13:15:55 2000 Delivered-To: freebsd-questions@freebsd.org Received: from guru.mired.org (zoom0-106.telepath.com [216.14.0.106]) by hub.freebsd.org (Postfix) with SMTP id 928B837B422 for ; Tue, 29 Aug 2000 13:15:52 -0700 (PDT) Received: (qmail 26927 invoked by uid 100); 29 Aug 2000 20:15:08 -0000 From: Mike Meyer MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <14764.6604.38405.949046@guru.mired.org> Date: Tue, 29 Aug 2000 15:15:08 -0500 (CDT) To: Ronald Klop Cc: questions@freebsd.org Subject: detecting reboot In-Reply-To: <84696825@toto.iv> X-Mailer: VM 6.72 under 21.1 (patch 10) "Capitol Reef" XEmacs Lucid X-face: "5Mnwy%?j>IIV\)A=):rjWL~NB2aH[}Yq8Z=u~vJ`"(,&SiLvbbz2W`;h9L,Yg`+vb1>RG% *h+%X^n0EZd>TM8_IB;a8F?(Fb"lw'IgCoyM.[Lg#r\ Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Ronald Klop writes: > How do I detect in a script in /usr/local/etc/rc.d that the machine just > rebooted in stead of going to single-user and back to multi-user. Ok, I'm curious - why do you want to do this? Answering could benefit you as well, as someone may have a better way of doing what you're trying to do than this particular test. My solution would be to tweak init to leave a cookie whenever it either forked a single user shell, or shut down to single user, depending on how you wanted to count the case of booting to single user and then going multi-user. The script could then check for the existence (or lack thereof) of the cookie. Having the source is a *wonderful* thing.