-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathstart_snapshot.sh
More file actions
executable file
·43 lines (33 loc) · 958 Bytes
/
start_snapshot.sh
File metadata and controls
executable file
·43 lines (33 loc) · 958 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
set -e
if [ $# -lt 3 ]; then
echo "Usage: ./start_snapshot.sh HH MM numports [passed arguments]"
exit 1
fi
HH=$1
MM=$2
NUMPORTS=$3
echo "Current Time is `date +%H:%M`."
echo "Snapshots will start at ${HH}:${MM}."
echo "Initiating on ports 1 - ${NUMPORTS}"
shift 3
CORES=$((`nproc` - 1))
STEP=$((${NUMPORTS}/${CORES}))
NUM_HIGH=$((${NUMPORTS} - (${STEP} * ${CORES})))
NUM_LOW=$((${CORES} - ${NUM_HIGH}))
PORT=1
for (( i=0; i < ${NUM_HIGH}; i++))
do
#echo "high starting ${PORT}, ending inclusive: $((${PORT} + ${STEP}))"
sudo out/startsnap -d veth1 ${HH} ${MM} ${PORT} $((${PORT} + ${STEP} + 1)) $@ &
PORT=$((${PORT} + ${STEP} + 1))
done
if [ "$STEP" != 0 ]; then
for (( i=0; i < ${NUM_LOW}; i++))
do
#echo "starting: ${PORT}, ending inclusive: $((${PORT} + ${STEP} - 1))"
sudo out/startsnap -d veth1 ${HH} ${MM} ${PORT} $((${PORT} + ${STEP})) $@ &
PORT=$((${PORT} + ${STEP}))
done
fi
wait