2010-11-15 12:31:29 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2011-05-08 20:08:34 +02:00
|
|
|
processes=30
|
2010-11-15 12:31:29 +01:00
|
|
|
i=0
|
|
|
|
|
|
|
|
while [ "$i" -lt "$processes" ]
|
|
|
|
do
|
|
|
|
python servertest.py "$i" &
|
|
|
|
pids=( ${pids[@]} $! )
|
2010-11-15 12:44:10 +01:00
|
|
|
echo ${pids["$i"]}
|
2010-11-15 12:31:29 +01:00
|
|
|
i=$((i+1))
|
2010-11-16 20:27:22 +01:00
|
|
|
#sleep 0.1
|
2010-11-15 12:31:29 +01:00
|
|
|
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
|