3 # exercises the -m option to pmlogger_daily
5 # Note: this test will fail in the few days after a daylight savings
6 # change as the sample NOTICES file is not quite right
8 # Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
12 echo "QA output created by $seq"
14 # get standard environment, filters and checks
19 # This test is not stable in the vicinity of a timezone change, e.g.
20 # daylight saving or summer time transitions.
21 # Don't run if this happened in the last 1 day.
24 now_hr_1
=`pmdate -1d '%H'`
25 if [ "$now_hr" != "$now_hr_1" ]
27 _notrun
"timezone change? now = ${now_hr}H:??M, yesterday = ${now_hr_1}H:??M"
32 NOTICES
=$PCP_LOG_DIR/NOTICES
34 HOME
=`$PCP_AWK_PROG -F: '/^pcpqa/ { print $6 }' /etc/passwd`
35 FORWARD
="$HOME/.forward"
38 echo quit |
$PCP_BINADM_DIR/telnet-probe localhost
$smtp_port \
39 || _notrun
"Noone listening on smtp port $smtp_port"
43 # put stuff we moved back in place
44 [ -f $tmp.notices
] && $sudo mv $tmp.notices
$NOTICES
45 [ -f $tmp.
mail ] && $sudo mv $tmp.
mail $MAIL
46 [ -f $tmp.forward
] && $sudo mv $tmp.forward
$FORWARD
52 sed -e 's/[A-Z][a-z][a-z] [A-Z][a-z][a-z] *[0-9][0-9]* [0-9][0-9]:[0-9][0-9]:[0-9][0-9] [0-9][0-9][0-9][0-9]$/DATESTAMP/' \
53 -e 's/^[0-9][0-9]:[0-9][0-9]/TIME/' \
54 -e "s,$PCP_RC_DIR,\$PCP_RC_DIR,"
57 status
=1 # failure is the default!
58 trap "_cleanup; exit \$status" 0 1 2 3 15
61 # create a fake NOTICES file containing time-boundary entries
63 twodaysago
=`pmdate -2d '%a %b %e %T %Z %Y'`
64 earlyyesterday
=`pmdate -1d '%a %b %e %T %Y'`
65 timenow
=`pmdate '%a %b %e %T %Y'`
66 oneminago
=`pmdate -1M '%H:%M'`
67 intwomins
=`pmdate +5M '%H:%M'`
68 infourmins
=`pmdate +6M '%H:%M'`
70 # expect to get none from two days ago, 2 of 3 from yesterday,
71 # and all (1) from today
74 Started by pmlogger_daily: $twodaysago
75 09:38 stop pmcd from $PCP_RC_DIR/pcp
76 11:54 start pmcd from $PCP_RC_DIR/pcp
79 $oneminago stop pmcd from $PCP_RC_DIR/pcp
80 $intwomins start pmcd from $PCP_RC_DIR/pcp
81 $infourmins pmie: busy disk spindle 49.4:dks0d1@rattle
84 $oneminago stop pmcd from $PCP_RC_DIR/pcp
87 # real QA test starts here
88 $sudo mv $NOTICES $tmp.notices
89 [ -f $MAIL ] && $sudo mv $MAIL $tmp.
mail
90 [ -f $FORWARD ] && $sudo mv $FORWARD $tmp.forward
91 cp /dev
/null
$tmp.noconf
92 $sudo cp $tmp.new
$NOTICES
95 $sudo $PCP_BINADM_DIR/pmlogger_daily
-c $tmp.noconf
-m pcpqa@
$host
97 sleep 2 # let mail arrive (shouldn't take long)
100 cat $PCP_LOG_DIR/NOTICES.daily |
tee -a $seq.full | _filter