3 # pmlogger_daily ... do you work at all?
5 # OLD VERSION for YYDDMM style naming convention (see also 338)
7 # NOTE - THIS TEST WILL FAIL IF RUN IN THE FIRST 5 MINUTES AFTER
8 # MIDNIGHT - c'est la vie, I'm afraid.
10 # Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
14 echo "QA output created by $seq"
16 # get standard filters
21 # This test is not stable in the vicinity of a timezone change, e.g.
22 # daylight saving or summer time transitions.
23 # Don't run if this happened in the last 2 days.
26 now_hr_2
=`pmdate -2d '%H'`
27 if [ "$now_hr" != "$now_hr_2" ]
29 _notrun
"timezone change? now = ${now_hr}H:??M, 2 days ago = ${now_hr_2}H:??M"
37 /^Archive files older than/ { eatlines=1; longone=" "; print; next; }
38 eatlines { if ( match ($0, "^ ") ) {
39 for ( i=1; i <=NF; i++ ) {
40 longone = sprintf ("%s %s",longone,$i);
43 print longone | "fmt -76";
45 longone = ""; eatlines = 0;
50 END { if ( eatlines ) {
51 print longone | "fmt -76";
59 -e "s/`hostname`/HOST/g" \
60 -e "s/localhost/HOST/g" \
61 -e "s/local:/HOST/g" \
62 -e "s/`hostname | sed -e 's/\..*//'`/HOST/g" \
63 -e '/\/var\/adm\/pcplog\/NOTICES/d' \
64 -e 's/-rw-r--r--\./-rw-r--r--/' \
66 /-rw-r--r--/ { print $1,"...",$5,"...",$9; next }
68 | _filter_cron_scripts
71 status
=1 # failure is the default!
72 trap "cd $here; $sudo rm -rf $tmp $tmp.*; $sudo mv $PCP_LOG_DIR/NOTICES.$$ $PCP_LOG_DIR/NOTICES; exit \$status" 0 1 2 3 15
74 # take explicit control of the umask
78 $sudo mv $PCP_LOG_DIR/NOTICES
$PCP_LOG_DIR/NOTICES.$$
83 # real QA test starts here
88 for day
in 0 1 2 3 4 5
91 # aiming for the time to be 00:02 and 00:04 on each day,
92 # even if that is ahead of NOW for today
97 min2
=`expr 2 - $now_min`
98 [ "$min2" -ge 0 ] && min2
="+$min2"
99 min4
=`expr 4 - $now_min`
100 [ "$min4" -ge 0 ] && min4
="+$min4"
101 namea
=`pmdate -${day}d ${hour}H ${min2}M $fmt.%H.%M`
102 nameb
=`pmdate -${day}d ${hour}H ${min4}M $fmt.%H.%M`
103 yesterday
=`pmdate -1d ${hour}H ${min2}M $fmt`
104 stampa
=`echo $namea | sed -e 's/\.//g'`
105 stampb
=`echo $nameb | sed -e 's/\.//g'`
106 echo "s/$namea/NOW-$day.00.02/g" >>$tmp/sed
107 echo "s/$nameb/NOW-$day.00.04/g" >>$tmp/sed
109 for ext
in 0 index meta
111 cp archives
/arch_a.
$ext $tmp/$namea.
$ext
112 touch -t $stampa $tmp/$namea.
$ext
113 cp archives
/arch_b.
$ext $tmp/$nameb.
$ext
114 touch -t $stampb $tmp/$nameb.
$ext
117 ls -lt $tmp >>$seq.full
118 echo "s/NOW-0/TODAY/g" >>$tmp/sed
119 echo "s/NOW-1/YESTERDAY/g" >>$tmp/sed
120 echo "s/`pmdate %y%m%d`/TODAY/g" >>$tmp/sed
121 echo "s/$yesterday/YESTERDAY/g" >>$tmp/sed
123 echo >$tmp/control
'$version=1.1
124 LOCALHOSTNAME n n '"$tmp"' ./config'
127 echo "=== [${verbose+verbose}] regular show ==="
128 echo "=== [${verbose+verbose}] regular show ===" >>$seq.full
129 $sudo $PCP_BINADM_DIR/pmlogger_daily
-o -c $tmp/control
-k 3 $verbose -l $tmp.log
130 $sudo cat $tmp.log | _filter
131 ls $tmp |
sed -f $tmp/sed | LC_COLLATE
=POSIX
sort
134 echo "=== [${verbose+verbose}] nothing to do but cull some more ==="
135 echo "=== [${verbose+verbose}] nothing to do but cull some more ===" >>$seq.full
136 for ext
in 0 index meta
138 mv $tmp/$yesterday.
$ext $tmp/save.
$ext
140 $sudo $PCP_BINADM_DIR/pmlogger_daily
-o -c $tmp/control
-k 2 $verbose -l $tmp.log
141 $sudo cat $tmp.log | _filter
142 ls $tmp |
sed -f $tmp/sed | LC_COLLATE
=POSIX
sort
145 echo "=== [${verbose+verbose}] error, output already exists ==="
146 echo "=== [${verbose+verbose}] error, output already exists ===" >>$seq.full
147 for ext
in 0 index meta
149 cp archives
/arch_a.
$ext $tmp/$yesterday.17.18.
$ext
150 mv $tmp/save.
$ext $tmp/$yesterday.
$ext
152 $sudo $PCP_BINADM_DIR/pmlogger_daily
-o -c $tmp/control
-k 2 $verbose -l $tmp.log
153 $sudo cat $tmp.log | _filter
154 ls $tmp |
sed -f $tmp/sed | LC_COLLATE
=POSIX
sort