-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathfinishTests.sh
executable file
·67 lines (61 loc) · 2.12 KB
/
finishTests.sh
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
#!/bin/sh
usage=$(
cat <<EOF
$0 [OPTION]
-u VALUE set "u" argument to specify type of test to stop. Test types: CSP/BSP/smtp
EOF
)
userType=""
while getopts "u:i" OPTION; do
case "$OPTION" in
u)
userType="$OPTARG"
;;
*)
echo "unrecognized option"
echo "$usage"
;;
esac
done
if [ ! -z "$userType" ]; then {
mkdir log_$(date +'%m-%d_%H-%M')
echo "creating log_$(date +'%m-%d_%H-%M') for backup directory"
mv logs/* log_$(date +'%m-%d_%H-%M')
}
else {
echo "Please specify -u option with type of test to stop (CSP or BSP or smtp).\nExample: \" sh finishTests.sh -u CSP\" "
}
fi
if [ "$userType" = "BSP" ]; then {
for i in `ps -fx|grep jmeter |awk -F " " {'print$1'}`; do kill -9 $i; done
[ ! -d BSP-imap.out ] && mv BSP-imap.out log_$(date +'%m-%d_%H-%M')
[ ! -d BSP-pop.out ] && mv BSP-pop.out log_$(date +'%m-%d_%H-%M')
[ ! -d BSP-zsoap.out ] && mv BSP-zsoap.out log_$(date +'%m-%d_%H-%M')
}
else {
if [ "$userType" = 'CSP' ]; then {
for i in `ps -fx|grep jmeter |awk -F " " {'print$1'}`; do kill -9 $i; done
[ ! -d CSP-imap.out ] && mv CSP-imap.out log_$(date +'%m-%d_%H-%M')
[ ! -d CSP-pop.out ] && mv CSP-pop.out log_$(date +'%m-%d_%H-%M')
[ ! -d CSP-zsoap.out ] && mv CSP-zsoap.out log_$(date +'%m-%d_%H-%M')
}
else {
if [ "$userType" = 'smtp' ]; then {
for i in `ps -fx|grep jmeter |awk -F " " {'print$1'}`; do kill -9 $i; done
[ ! -d generic-smtp.out ] && mv generic-smtp.out log_$(date +'%m-%d_%H-%M')
}
else {
if [ "$userType" = 'CSP2' ]; then {
for i in `ps -fx|grep jmeter |awk -F " " {'print$1'}`; do kill -9 $i; done
[ ! -d CSP2-imap.out ] && mv CSP2-imap.out log_$(date +'%m-%d_%H-%M')
[ ! -d CSP2-pop.out ] && mv CSP2-pop.out log_$(date +'%m-%d_%H-%M')
[ ! -d CSP2-zsoap.out ] && mv CSP2-zsoap.out log_$(date +'%m-%d_%H-%M')
[ ! -d CSP2-lmtp.out ] && mv CSP2-lmtp.out log_$(date +'%m-%d_%H-%M')
}
fi
}
fi
}
fi
}
fi