pmrep: update TODO, man page
[pcp.git] / qa / 808
blob8469f989da4e7f47de17e564ea197dcb433da9b6
1 #!/bin/sh
2 # PCP QA Test No. 808
3 # exercise pmlogger stale pid files issues
5 # Copyright (c) 2015 Red Hat. All Rights Reserved.
6 # Copyright (c) 2015 Mark Goodwin. All Rights Reserved.
9 seq=`basename $0`
10 echo "QA output created by $seq"
12 # get standard environment, filters and checks
13 . ./common.product
14 . ./common.filter
15 . ./common.check
17 status=1 # failure is the default!
18 $sudo rm -rf $tmp.* $seq.full
19 trap "cd $here; rm -rf $tmp.*; exit \$status" 0 1 2 3 15
21 # real QA test starts here
23 pid=`$PCP_PS_PROG $PCP_PS_ALL_FLAGS | grep 'pmlogger.*-P' | \
24 grep -v grep | awk '{print $2}'`
26 if [ ! -S "$PCP_RUN_DIR/pmlogger.$pid.socket" ]; then
27 echo FAIL no primary pmlogger running? pid=$pid
28 status=1
29 else
30 echo found primary pmlogger and found control socket in PCP_RUN_DIR
32 echo === killing the primary pmlogger with SIGKILL ===
33 $sudo kill -9 $pid
35 echo === running pmlogger_check to restart primary logger ===
36 $sudo $PCP_BINADM_DIR/pmlogger_check -C
37 sleep 2
39 newpid=`$PCP_PS_PROG $PCP_PS_ALL_FLAGS | grep 'pmlogger.*-P' | \
40 grep -v grep | awk '{print $2}'`
42 if [ -z "$newpid" ]; then
43 echo FAIL pmlogger failed to start
44 echo pid of killed primary logger is $pid
45 echo === ls -l $PCP_RUN_DIR ===
46 ls -l $PCP_RUN_DIR
47 echo === manually removing stale run files ===
48 $sudo rm -f $PCP_RUN_DIR/*pmlogger*
49 status=1
50 exit
54 # Next test: check primary logger restarts with legacy hardlinks present
55 # This is a corner case, but can happen.
57 pid=`$PCP_PS_PROG $PCP_PS_ALL_FLAGS | grep 'pmlogger.*-P' | \
58 grep -v grep | awk '{print $2}'`
60 echo === checking with stale legacy hard links
61 echo === killing the primary pmlogger with SIGKILL ===
62 $sudo kill -9 $pid
64 # change the stale symlinks into hardlinks, to simulate an upgrade
65 # from an earlier version of pcp (before we converted to symlinks)
66 $sudo rm -f $PCP_TMP_DIR/pmlogger/primary
67 $sudo ln $PCP_TMP_DIR/pmlogger/$pid $PCP_TMP_DIR/pmlogger/primary
68 $sudo rm -f $PCP_RUN_DIR/pmlogger.primary.socket
69 $sudo ln $PCP_RUN_DIR/pmlogger.$pid.socket $PCP_RUN_DIR/pmlogger.primary.socket
71 echo === running pmlogger_check to restart primary logger ===
72 $sudo $PCP_BINADM_DIR/pmlogger_check -C
73 sleep 2
75 newpid=`$PCP_PS_PROG $PCP_PS_ALL_FLAGS | grep 'pmlogger.*-P' | \
76 grep -v grep | awk '{print $2}'`
78 if [ -z "$newpid" ]; then
79 echo FAIL pmlogger failed to start
80 echo pid of killed primary logger is $pid
81 echo === ls -il $PCP_RUN_DIR ===
82 ls -il $PCP_RUN_DIR
83 echo === manually removing stale run files ===
84 $sudo rm -f $PCP_RUN_DIR/*pmlogger*
85 status=1
86 exit
89 # success
90 status=0
93 exit