From owner-freebsd-questions Wed Aug 30 2: 5: 3 2000 Delivered-To: freebsd-questions@freebsd.org Received: from node11a94.a2000.nl (node11a94.a2000.nl [24.132.26.148]) by hub.freebsd.org (Postfix) with SMTP id DD32137B423 for ; Wed, 30 Aug 2000 02:04:58 -0700 (PDT) Received: (qmail 37399 invoked from network); 30 Aug 2000 09:04:56 -0000 Received: from dlanor.evertsen.nl (10.0.0.3) by bak.evertsen.nl with SMTP; 30 Aug 2000 09:04:56 -0000 Date: Wed, 30 Aug 2000 11:04:57 +0200 (CEST) From: Ronald Klop To: Mike Meyer Cc: questions@freebsd.org Subject: Re: detecting reboot In-Reply-To: <14764.6604.38405.949046@guru.mired.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tue, 29 Aug 2000, Mike Meyer wrote: > 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. I'm keeping some statistics about network traffic which is displayed in a webpage. After a reboot these numbers must be reset to zero. (I keep the numbers in some files). If I'm going going to single user and back the uptime doesn't reset, so I don't have to reset my stats. > > 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. Tweaking /etc/rc gives the same result. (See my other posting.) > > Having the source is a *wonderful* thing. Yep. > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message > - -- Ronald Klop http://klop.yi.org/ http://www.FreeBSD.org/ http://klop.yi.org/~ronald/ PGP: http://klop.yi.org/~ronald/pgp.txt mailto:ronald@klop.yi.org?Subject=publicpgpkey -----BEGIN PGP SIGNATURE----- Version: PGPfreeware 5.0i for non-commercial use Charset: noconv iQA/AwUBOazOOhk9lWSXChWeEQIpPgCfV66WhmA8cmULxBN4c2Bx8sOSmN0AoJni Mp6RBXs2NMtXiX6U4QToKCTl =Dkxx -----END PGP SIGNATURE----- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message