-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathload.sh
More file actions
executable file
·44 lines (34 loc) · 781 Bytes
/
load.sh
File metadata and controls
executable file
·44 lines (34 loc) · 781 Bytes
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
#!/bin/bash
bin=$1
if [[ -z "$bin" ]]; then
bin="./dist/"$(ls ./dist/ | grep "load-" | head -1)
fi
if [[ -z "$COUNT" ]]; then
echo "Count required"
exit 1
fi
if [[ -z "$LOGS_DIRECTORY" ]]; then
echo "Count required"
exit 1
fi
if [[ -z "$MAX" ]]; then
echo "Max required"
exit 1
fi
if [[ -z "$URL" ]]; then
echo "URL required"
exit 1
fi
if [[ $(($MAX%$COUNT)) != 0 ]]; then
echo "Wrong values"
exit 1
fi
workers=$(($MAX/$COUNT))
min=1
max=$(($workers))
for i in `seq 1 $COUNT`; do
URL=$URL MIN=$min MAX=$max nohup $bin </dev/null > "$LOGS_DIRECTORY/load_$i.log" 2>&1 &
echo "URL=$URL MIN=$min MAX=$max nohup $bin </dev/null > \"$LOGS_DIRECTORY/load_$i.log\" 2>&1 &"
min=$(($max+1))
max=$(($min+$workers-1))
done