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
|
#!/bin/bash
MYDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
CNAME="speedtest"
count=${1}
if [ -z "${count}" ]; then
echo "USAGE: ${0} 10"
echo "This creates 10 busybox containers"
exit 1
fi
if [ "${2}" != "notime" ]; then
time ${0} "${count}" notime
exit 0
fi
"${MYDIR}/deps/import-busybox" --alias busybox
PIDS=""
for c in $(seq "$count"); do
incus init busybox "${CNAME}${c}" 2>&1 &
PIDS="$PIDS $!"
done
for pid in $PIDS; do
wait "$pid"
done
echo -e "\nincus list: All shutdown"
time incus list 1> /dev/null
PIDS=""
for c in $(seq "$count"); do
incus start "${CNAME}${c}" 2>&1 &
PIDS="$PIDS $!"
done
for pid in $PIDS; do
wait "$pid"
done
echo -e "\nincus list: All started"
time incus list 1> /dev/null
echo -e "\nRun completed"
|