Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Aug 2000 11:04:57 +0200 (CEST)
From:      Ronald Klop <ronald@klop.yi.org>
To:        Mike Meyer <mwm@mired.org>
Cc:        questions@freebsd.org
Subject:   Re: detecting reboot
Message-ID:  <Pine.BSF.4.21.0008301101580.1829-100000@dlanor.evertsen.nl>
In-Reply-To: <14764.6604.38405.949046@guru.mired.org>

next in thread | previous in thread | raw e-mail | index | archive | help
-----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.

> 
> 	<mike
> 
> 
> 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0008301101580.1829-100000>