npvhash=4095 also appears in my All Messages log during a normal, user-inititated restart:
12/12/08 10:04:31 PM kernel Debug npvhash=4095
Hey MMT3... thanks!
Hmm, interesting how yours has that "Debug" word there.
Mine simply says:
Dec 13 14:41:48 localhost kernel[0]: npvhash=4095
--
Well, apparently this 'check shutdowns' script is still a work in progress. And -- although
originally intended as being for shutdown checking exclusively -- my most recent revision
[see below] can be *optionally* used to search system.log for
any user-specified string.
Hopefully these additions will make it an even handier troubleshooting tool...
Change history:- instead of accepting an integer-only argument, the line count must be preceded by a -l flag (that's an l as in "line")
- script still defaults to npvhash for Leopard and quantum for Tiger... but *any* text can be specified using the -t flag (t for "text")
- the default line count is now 15 (instead of 22)
So -- for basic shutdown checks -- we can still type just "csd" to have it run with default settings.
But now, stuff like this is also possible:
csd -l 22 # increase line count to 22
csd -t 'Darwin Kernel Version' # search for the phrase 'Darwin Kernel Version'
csd -t error # search for the word 'error' instead (searches are case-sensitive)
csd -t [Ee]rror # search for either 'Error' or 'error'
csd -t '([Ee]rror|[Ff]ail)' # search for lines containing either 'Error' or 'error' or 'Fail' or 'fail'
csd -l 3 -t $USER # set line count to 3 and search for your username
Perhaps not all examples above are useful... just illustrating some possibilities.
(The "line count" principle works the same: find a keyword (or phrase) and include that number of lines *before* it).
#!/bin/bash -
# csd ::: Check ShutDowns
#(c)EF/-HI-2008.Dec.02 [rev:2008.Dec.12]
IFS=$' \t\n'
PATH=/bin:/usr/bin
export PATH
PROG=`basename $0`
declare -i XCOD=0 v=0 default=15 max=511
x=; v=`sw_vers -productVersion |awk -F. '{ print $2 }'`
t=npvhash; k=bzgrep; [ $v -lt 5 ] && t=quantum && k=zgrep
QuitMess ()
{
printf '\n \e[7mCheck ShutDowns\e[0m\n \e[1m'
printf 'search for text in all system.log files'
printf '\e[0m\n optionally set line count & grep '
printf 'string\n Usage: \e[1m%s \e[0m [' $PROG
printf '\e[1m -l\e[0m \e[4mN\e[0m ] [\e[1m -t'
printf '\e[0m "\e[4msome\e[0m \e[4mtext\e[0m" ]'
printf '\n where 0 < N < %d and' $(( max+=1 ))
printf ' N = %d by default\n\n' $default
exit 1
}
[[ $1 = --* ]] && QuitMess >&2
while getopts :l:t: opshun
do
case $opshun in
l) x=$OPTARG ;;
t) t=$OPTARG ;;
?) [[ $OPTARG != [hH]* ]] &&
echo "invalid option '-$OPTARG'"
QuitMess >&2 ;;
esac
done
lines=${x:-$default}
if [ -n "$(echo $lines |sed 's/[0-9]//g')" ] ||
[ $lines -lt 1 ] || [ $lines -gt $max ]
then
echo "improper value for -l argument: $lines" >&2
QuitMess >&2
else
for f in `ls -r /var/log/system.log*`
do
printf '\n\e[1m%s\e[0m >> \n' $f
eval $k --color -B $lines -e \""$t"\" $f
(( XCOD+=$? ))
echo
done
fi
[ $XCOD -ne 0 ] && echo "$XCOD file(s) had no match"
exit $XCOD