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.
10 echo "QA output created by $seq"
12 # get standard environment, filters and checks
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
30 echo found primary pmlogger and found control socket
in PCP_RUN_DIR
32 echo === killing the primary pmlogger with SIGKILL
===
35 echo === running pmlogger_check to restart primary logger
===
36 $sudo $PCP_BINADM_DIR/pmlogger_check
-C
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 ===
47 echo === manually removing stale run files
===
48 $sudo rm -f $PCP_RUN_DIR/*pmlogger
*
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
===
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
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 ===
83 echo === manually removing stale run files
===
84 $sudo rm -f $PCP_RUN_DIR/*pmlogger
*