-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_bin.sh
executable file
·68 lines (54 loc) · 1.8 KB
/
run_bin.sh
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env bash
#-----------------------------------------------------------------------------------------------------------------------
# HELP function
#-----------------------------------------------------------------------------------------------------------------------
function help {
usage="$(basename "$0") [-h] -s <file> -m <file> -p <file> -- runs the Autonomous Wi-Fi Direct (AWD) simulations.
where:
-h show this help
-s scenario config file
-m max clients config file
-p parameters config file"
printf "${usage}\n"
exit -1
}
#-----------------------------------------------------------------------------------------------------------------------
# Check the script's arguments
#-----------------------------------------------------------------------------------------------------------------------
function check_arguments {
if [ "$#" == 1 ] && [ "$1" = "-h" ]; then
help
elif [ "$#" -ne 6 ]; then
echo "Error: Illegal number of arguments"
help
fi
while [[ $# -gt 1 ]]
do
key="$1"
case $key in
-s)
SCENARIO_CONFIG="$2"
shift # past argument
;;
-m)
MAX_CLIENTS_CONFIG="$2"
shift # past argument
;;
-p)
PARAMETERS_CONFIG="$2"
shift # past argument
;;
esac
shift # past argument or value
done
if [ -z "$SCENARIO_CONFIG" ] || [ -z "$PARAMETERS_CONFIG" ] || [ -z "$MAX_CLIENTS_CONFIG" ]; then
echo "Error: Illegal arguments"
help
fi
}
#-----------------------------------------------------------------------------------------------------------------------
# MAIN
#-----------------------------------------------------------------------------------------------------------------------
check_arguments "$@"
jar_path="awd-sim.jar"
java -jar ${jar_path} ${SCENARIO_CONFIG} ${PARAMETERS_CONFIG} ${MAX_CLIENTS_CONFIG}