Nice utility!

Best regards

Konrad Heuer
GWDG, Am Fassberg, 37077 Goettingen, Germany, [email protected]

On Tue, 28 Jun 2011, Devin Teske wrote:

I've written a new script. It's called "lastdown".

What it does is pretty simple, but yet oh-so valuable to us for administering 
large clusters.

1. Use sysctl(8) to get the ``kern.boottime'' MIB
2. Parse the `sec' value from the above
3. Make optional adjustments
4. Pass value to date(1) to format it in CCYYddmmHHMM.SS format
5. Pass formatted date string to last(8)'s `-d' argument to... wait for it...

List the users that were on that system during that time.

At first, I just wrote this to see if last(8)'s manual was accurate. That is, I 
wanted to see what exactly it would have to say if I gave it a value. Well, 
after playing with it -- and then not -- I realized one of the more practical 
applications of it might be to list the state of the UTMP(5) log from 
just-before the system booted.

Running this on a cluster is fun. You get to see all the people that (pardon my 
[non-]French, but) got screwed when last the system took a long walk in the 
desert (looking for it's horse no doubt *chuckles*).

I just wanted to clean this up, release it under the BSD License for all, and 
then sleep on how to implement the next iteration (you'll notice it's internal 
version in the header states it's at 2.0 -- there was an uglier predecessor).

If you head on over to http://druidbsd.sourceforge.net/ you'll see examples where the 
UTMP(5) log (that's the wtmp file) begins on a date that is after the boottime and you'll 
have to specific "-f /var/log/wtmp.1" for example to query a log that knows 
about the state of the machine at boot time. I'm going to dream up ways to automatically 
when I should go back.

The code can be had at:

        http://druidbsd.sourceforge.net/download/lastdown.txt

or

        http://druidbsd.sourceforge.net/
--
Cheers,
Devin Teske


-> LEGAL DISCLAIMER <-
This message  contains confidential  and proprietary  information
of the sender,  and is intended only for the person(s) to whom it
is addressed. Any use, distribution, copying or disclosure by any
other person  is strictly prohibited.  If you have  received this
message in error,  please notify  the e-mail sender  immediately,
and delete the original message without making a copy.

-> FUN STUFF <-
-----BEGIN GEEK CODE BLOCK-----
Version 3.12
GAT/CS/B/CC/E/IT/MC/M/MU/P/S/TW d+(++) s: a- C+++@$ UB++++$ P++++@$ L++++$ E-
W+++ N? o? K? w@ O M++$ V- PS+>++ PE@ Y+ PGP-> t(+) 5? X(+) R(-) tv+ b+>++ DI+
D+(++) G++ e>++++ h r+++ z+++
------END GEEK CODE BLOCK------
http://www.geekcode.com/

-> END TRANSMISSION <-

_____________

The information contained in this message is proprietary and/or confidential. 
If you are not the intended recipient, please: (i) delete the message and all 
copies; (ii) do not disclose, distribute or use the message in any manner; and 
(iii) notify the sender immediately. In addition, please be aware that any 
message addressed to our domain is subject to archiving and review by persons 
other than the intended recipient. Thank you.
_____________
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[email protected]"

_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[email protected]"

Reply via email to