-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathstart-test.sh
executable file
·44 lines (35 loc) · 1.09 KB
/
start-test.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
#!/bin/bash
# -n 5 -c 1 http://www.yahoo.com/
number=$REQUESTS
concur=$CONCURRENCY
url=$URL
verbose=$VERBOSITY
timeout=$TIMEOUT
timelimit=$TIMELIMIT
cmd=
if [[ "$@" != "" ]]
then
echo "command line provided overrides ENVs"
cmd=$@
else
echo "using ENVs
REQUESTS : $REQUESTS - number of requests
CONCURRENCY : $CONCURRENCY - number of parallel requests
URL : $URL - url to test, make sure it ends with a /
VERBOSITY : $VERBOSITY - level of verbosity (optional)
TIMELIMIT : $TIMELIMIT - how long to run the test for, overrides REQUESTS (optional)
TIMEOUT : $TIMEOUT - request timeout (optional)"
cmd="-n $REQUESTS -c $CONCURRENCY"
[[ "$VERBOSITY" != "" ]] && cmd="$cmd -v $VERBOSITY"
[[ "$TIMELIMIT" != "" ]] && cmd="$cmd -t $TIMELIMIT"
[[ "$TIMEOUT" != "" ]] && cmd="$cmd -s $TIMEOUT"
cmd="$cmd $URL"
fi
echo "**********************************
Test starting $(date)
**********************************
Running now: ab $cmd"
/usr/bin/ab $cmd
echo "**********************************
Test finished $(date)
**********************************"