25 lines
335 B
Bash
Executable File
25 lines
335 B
Bash
Executable File
#!/bin/bash
|
|
|
|
processes=80
|
|
i=0
|
|
|
|
while [ "$i" -lt "$processes" ]
|
|
do
|
|
python servertest.py "$i" &
|
|
pids=( ${pids[@]} $! )
|
|
echo ${pids["$i"]}
|
|
i=$((i+1))
|
|
#sleep 0.1
|
|
done
|
|
|
|
#wait for input to exit
|
|
read -n1 -s
|
|
|
|
#kill our background pythons
|
|
i=0
|
|
while [ "$i" -lt "$processes" ]
|
|
do
|
|
echo "${pids["$i"]}"
|
|
kill "${pids["$i"]}"
|
|
i=$((i+1))
|
|
done |