-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathqc_dump
executable file
·49 lines (41 loc) · 1.07 KB
/
qc_dump
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
#!/bin/bash
# Copyright IBM Corp. 2016, 2020
qcbin="zname";
if [ $# -eq 1 ]; then
qcbin="$1";
if [ ! -x $qcbin ]; then
echo "Error: $qcbin not found or not executable";
exit 1;
fi
else
which $qcbin > /dev/null;
if [ $? -ne 0 ]; then
echo "Error: $qcbin not found or not executable";
echo "Note: You can specify an arbitrary executable as an argument to qc_dump";
exit 2;
fi
fi
echo "Executing $qcbin...";
$qcbin -dd --json >/tmp/ref_result.txt 2>/tmp/ref_trace.txt;
if [ $? -ne 0 ]; then
echo "$qcbin failed - good thing we're creating a dump";
fi
echo "Adding further content...";
cd /tmp
dump="`ls -rtd qclib-??????.dump-1 2>/dev/null | tail -1`";
if [ "$dump" == "" ]; then
echo "Error: No dump data found, sorry";
exit 3;
fi
mv ref_result.txt $dump;
mv ref_trace.txt $dump;
lscpu -e > $dump/lscpu.output;
hostname > $dump/hostname.output;
tgt=${dump%.*}.tgz;
if [ -e /dev/vmcp ]; then
vmcp QUERY MULTITHREAD > $dump/QUERY_MULTITHREAD.output;
fi
echo "Creating package...";
tar cvfz $tgt $dump | sed -e 's/^/ /g';
echo "Dump written to $PWD/$tgt";
exit 0;