/var/lib/pcp/testsuite/1059 is in pcp-testsuite 4.0.1-1.
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 | #!/bin/sh
# PCP QA Test No. 1059
# pmcd run file and (maybe) unix domain socket are all OK
#
# Copyright (c) 2017 Ken McDonell. All Rights Reserved.
#
seq=`basename $0`
echo "QA output created by $seq"
# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check
status=0 # success is the default!
$sudo rm -rf $tmp $tmp.* $seq.full
trap "cd $here; $sudo rm -rf $tmp $tmp.*; exit \$status" 0 1 2 3 15
error=false
warn=false
# real QA test starts here
_get_pids_by_name -a pmcd >$tmp.pid
if [ ! -s $tmp.pid ]
then
echo "Error: no running pmcd process"
error=true
else
if [ "`wc -l <$tmp.pid | sed -e 's/ //g'`" -gt 1 ]
then
echo "Error: multiple pmcd processes running"
$PCP_PS_PROG $PCP_PS_ALL_FLAGS | egrep '[P]PID|pmcd'
error=true
fi
if [ -d $PCP_RUN_DIR ]
then
if [ ! -f $PCP_RUN_DIR/pmcd.pid ]
then
echo "Error: no $PCP_RUN_DIR/pmcd.pid file"
error=true
else
if grep "^`cat $PCP_RUN_DIR/pmcd.pid`\$" $tmp.pid >/dev/null
then
echo "Info: pmcd's PID matches $PCP_RUN_DIR/pmcd.pid"
else
echo "Error: $PCP_RUN_DIR/pmcd.pid (`cat $PCP_RUN_DIR/pmcd.pid`) does not match running pmcds:"
sed -e 's/^/ /' <$tmp.out
error=true
fi
if grep -v "^`cat $PCP_RUN_DIR/pmcd.pid`\$" $tmp.pid >$tmp.out
then
echo "Error: $PCP_RUN_DIR/pmcd.pid (`cat $PCP_RUN_DIR/pmcd.pid`) does not match these pmcd PID(s):"
sed -e 's/^/ /' <$tmp.out
fi
fi
if [ -e $PCP_RUN_DIR/pmcd.socket ]
then
if [ -S $PCP_RUN_DIR/pmcd.socket ]
then
if which lsof >/dev/null 2>&1
then
$sudo lsof -U 2>/dev/null \
| grep $PCP_RUN_DIR/pmcd.socket \
| $PCP_AWK_PROG '$1 != "COMMAND" { print $1,$2 }' \
| sort \
| uniq >$tmp.tmp
if grep "^pmcd `cat $PCP_RUN_DIR/pmcd.pid`\$" $tmp.tmp >/dev/null
then
echo "Info: pmcd's PID matches $PCP_RUN_DIR/pmcd.socket owner"
else
echo "Error: pmcd's PMID (`cat $PCP_RUN_DIR/pmcd.pid`) does not match $PCP_RUN_DIR/pmcd.socket owner"
$sudo lsof -U | grep $PCP_RUN_DIR/pmcd.socket
error=true
fi
if grep -v "^pmcd `cat $PCP_RUN_DIR/pmcd.pid`\$" $tmp.tmp >$tmp.out
then
echo "Error: $PCP_RUN_DIR/pmcd.socket attached to processes other than pmcd:"
sed -e 's/^/ /' <$tmp.out
fi
else
# no lsof, sigh ... fake it
echo "Info: pmcd's PID matches $PCP_RUN_DIR/pmcd.socket owner"
fi
else
echo "Error: $PCP_RUN_DIR/pmcd.socket is not a socket"
ls -l $PCP_RUN_DIR/pmcd.socket
fi
else
echo "Error: no $PCP_RUN_DIR/pmcd.socket socket"
fi
else
echo "Warning: no $PCP_RUN_DIR directory"
warn=true
fi
fi
# all done, exit status depends on errors or warnings
#
if $error
then
status=4
elif $warn
then
status=1
else
status=0
fi
exit
|