/var/lib/pcp/testsuite/280 is in pcp-testsuite 3.8.12ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | #! /bin/sh
# PCP QA Test No. 280
# pmlogger_check basic sanity check
#
# Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
#
seq=`basename $0`
echo "QA output created by $seq"
# get standard filters
. ./common.product
. ./common.filter
. ./common.check
if [ -d $PCP_LOG_DIR/pmlogger ]
then
LOGGING_DIR=$PCP_LOG_DIR/pmlogger
else
LOGGING_DIR=$PCP_LOG_DIR
fi
_filter()
{
[ -z "$PCP_PMLOGGERCONTROL_PATH" ] && \
PCP_PMLOGGERCONTROL_PATH="$PCP_SYSCONF_DIR/pmlogger/control"
PCP_PMLOGGERCONTROL_PATH=`dirname "$PCP_PMLOGGERCONTROL_PATH"`
sed \
-e 's/\.\.\.*/[dots]/' \
-e 's;/usr/var;/var;g' \
-e "s/`hostname`/LOCALHOST/g" \
-e "s/$LOCALHOST/LOCALHOST/g" \
-e "s/localhost/LOCALHOST/g" \
-e "s/local:/LOCALHOST/g" \
-e 's/^Reconfigured: .*pmlogconf.//g' \
-e 's;/private/;/;g' \
-e "s;$LOGGING_DIR;\$PCP_LOG_DIR;" \
-e "s;$PCP_LOG_DIR;\$PCP_LOG_DIR;" \
-e "s;$PCP_PMLOGGERCONTROL_PATH;\$PCP_PMLOGGERCONTROL_PATH;" \
-e 's/control:[0-9][0-9]*]/control:LINE]/' \
-e 's/process [0-9][0-9]*/process PID/' \
-e 's/\.* done/. done/' \
-e 's/[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]/CHECK/' \
-e 's/-rw-r--r--\./-rw-r--r--/' \
| _filter_cron_scripts
}
status=1 # failure is the default!
signal=$PCP_BINADM_DIR/pmsignal
LOCALHOST=`hostname`
[ $PCP_VER -lt 3806 ] && LOCALHOST=`echo $LOCALHOST | sed -e 's/\..*//'`
trap "rm -f $tmp.* $LOGGING_DIR/$LOCALHOST/lock; exit \$status" 0 1 2 3 15
rm -f $seq.full
# real QA test starts here
umask 022
# start from a known state
#
$sudo $PCP_RC_DIR/pcp stop >/dev/null 2>&1
$sudo $PCP_RC_DIR/pcp start | _filter_pcp_start
_wait_for_pmcd
_wait_for_pmlogger -P $LOGGING_DIR/$LOCALHOST/pmlogger.log
echo
echo "Ping primary logger ..." | tee -a $seq.full
echo 'connect primary' | pmlc
echo
echo "Expect this should do nothing ..." | tee -a $seq.full
$sudo $PCP_BINADM_DIR/pmlogger_check -V 2>&1 | tee -a $seq.full | _filter
echo 'connect primary' | pmlc
pid=`_get_primary_logger_pid`
if [ -z "$pid" ]
then
echo "Error: cannot find PID for primary logger"
LC_TIME=POSIX ls -l $PCP_TMP_DIR/pmlogger
pminfo -f pmcd.pmlogger
exit
fi
echo
echo "Kill off primary logger ..."
$sudo $signal -s TERM $pid
sleep 2
echo 'connect primary' | pmlc 2>&1 | _filter
pmafm $LOGGING_DIR/$LOCALHOST/Latest remove >$tmp.cmd 2>&1 \
&& $sudo sh $tmp.cmd
# delay to minimize risk of name clash
#
sleep 10
echo "Expect this to re-start the primary logger ..." | tee -a $seq.full
$sudo $PCP_BINADM_DIR/pmlogger_check -V 2>&1 | tee -a $seq.full | _filter
echo 'connect primary' | pmlc
pid=`_get_primary_logger_pid`
if [ -z "$pid" ]
then
echo "Error: cannot find PID for primary logger"
LC_TIME=POSIX ls -l $PCP_TMP_DIR/pmlogger
pminfo -f pmcd.pmlogger
exit
fi
echo
echo "Kill off primary logger ..."
$sudo $signal -s TERM $pid
sleep 2
echo 'connect primary' | pmlc 2>&1 | _filter
pmafm $LOGGING_DIR/$LOCALHOST/Latest remove >$tmp.cmd 2>&1 \
&& $sudo sh $tmp.cmd
# delay to minimize risk of name clash
#
sleep 10
echo
echo "Expect this to quietly re-start the primary logger ..." | tee -a $seq.full
$sudo $PCP_BINADM_DIR/pmlogger_check 2>&1 | tee -a $seq.full | _filter
echo 'connect primary' | pmlc
echo
echo "Expect this to get a mutex failure ..." | tee -a $seq.full
$sudo touch $LOGGING_DIR/$LOCALHOST/lock
$sudo $PCP_BINADM_DIR/pmlogger_check 2>&1 \
| tee -a $seq.full | _filter \
| $PCP_AWK_PROG '
/-r.-r.-r.-/ { $3 = "USER"; $4 = "GROUP"; $6 = "Mmm"; $7 = "D"; $8 = "YYYY" }
{ print }'
echo
echo "Expect this to cleanup an old lock file ..." | tee -a $seq.full
$sudo rm -f $LOGGING_DIR/$LOCALHOST/lock
$sudo touch -t 199701020304.00 $LOGGING_DIR/$LOCALHOST/lock
$sudo $PCP_BINADM_DIR/pmlogger_check 2>&1 \
| tee -a $seq.full | _filter \
| $PCP_AWK_PROG '
/-r.-r.-r.-/ { $3 = "USER"; $4 = "GROUP" }
{ print }'
$sudo rm -f $LOGGING_DIR/$LOCALHOST/lock
# success, all done
status=0
exit
|