summaryrefslogtreecommitdiffstats
path: root/run.sh.in
blob: 0ef7f14196073928e4098a939689c8b1b5c39c9a (plain)
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
#!/bin/sh
#
# json dbus bridge
#
# Copyright (c) 2010 by Michael Olbrich <m.olbrich@pengutronix.de>
#
# To the extent possible under law, Pengutronix e.K. has waived all copyright
# and related or neighboring rights to JSON-DBus-Bridge Demo Code.
#

if [ ! -f "@abs_builddir@/web-gui/index.html" ]; then
	echo
	echo 'You must run "make" before running this script'
	echo
	exit 1
fi

finish() {
	kill $hello_pid
	kill $calculator_pid
	kill $lighttpd_pid
	exit
}

trap finish SIGINT

"@abs_srcdir@/services/python/hello-world.py" &
hello_pid=$!

"@abs_srcdir@/services/python/calculator.py" &
calculator_pid=$!

@LIGHTTPD@ -f "@abs_builddir@/lighttpd/lighttpd.conf" -D &
lighttpd_pid=$!

echo -n "waiting for lighttpd "
for i in `seq 10`; do
	sleep 1
	echo -n "."
	wget -e no_proxy=localhost -O - -q http://localhost:8080/ > /dev/null && break
done

if [ $? -ne 0 ]; then
	echo
	echo
	echo starting lighttpd failed!
	finish
	exit 1
else
	echo
	echo
	echo lighttpd sucessfully started.
	echo
	echo The demo page can be view at http://localhost:8080/
fi

while [ 1 ]; do
	sleep 100
done