-
Notifications
You must be signed in to change notification settings - Fork 23
/
bencherlui
executable file
·65 lines (57 loc) · 1.71 KB
/
bencherlui
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
#!/bin/bash
# Controls the web server that serves the web interface of the benchmark suite.
usage()
{
cat << EOF
bencherlui is used to start the bencherl UI web server that can be
used to view benchmark results in a web browser. For bencherui to
work, bencherl UI needs to be compiled (make ui).
Usage: bencherlui [OPTION..]
Start or stop the web server that serves bencherl UI.
-h display this help and exit
-u start the web server that serves bencherl UI (change port in ui/bencherlui/boss.config)
-d stop the web server that serves bencherl UI
For complete documentation, see the README.md file.
EOF
}
if [ "$#" -ne 1 ] ; then
usage
exit 1
fi
START=`date +%s`
cd "$( dirname "${BASH_SOURCE[0]}" )"
while getopts ":udh" opt; do
case $opt in
h)
usage
exit 0
;;
u)
echo "Starting web server... The port can be changed in ui/bencherlui/boss.config."
cd ui/bencherlui
START_OUTPUT=$( { ./init.sh start; } 2>&1)
if [ "$START_OUTPUT" == 'starting boss in production mode...' ];
then
echo "Web server started."
host=`hostname -f`
port=`cat boss.config | grep port | grep -v db_port | cut -d',' -f 2 | cut -d'}' -f1 |sed -e 's/^[ \t]*//'`
echo "Use your web browser and go to http://$host:$port."
echo "Use the following command to stop the web server:"
echo "./bencherlui -d"
else
echo $START_OUTPUT
fi
exit 0
;;
d)
echo "Stopping web server..."
cd ui/bencherlui
./init.sh stop
exit 0
;;
\?)
echo "Invalid option: -$OPTARG"
exit 1
;;
esac
done