]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - apps/tidep0084.git/blob - tutorials/generic_sensor_tutorial/final/SensorToCloud/example/commissioner/scripts/launch_gateway.sh
Added Support for Generic Sensor Tutorial which provides instructions on how to add...
[apps/tidep0084.git] / tutorials / generic_sensor_tutorial / final / SensorToCloud / example / commissioner / scripts / launch_gateway.sh
1 #!/bin/bash
2 #############################################################
3 # @file run_demo.sh
4 #
5 # @brief TIMAC 2.0 run_demo.sh - run the ces-2016 demo
6 #
7 # Group: WCS LPC
8 # $Target Devices: Linux: AM335x, Embedded Devices: CC1310, CC1350$
9 #
10 #############################################################
11 # $License: BSD3 2016 $
12 #
13 #   Copyright (c) 2015, Texas Instruments Incorporated
14 #   All rights reserved.
15 #
16 #   Redistribution and use in source and binary forms, with or without
17 #   modification, are permitted provided that the following conditions
18 #   are met:
19 #
20 #   *  Redistributions of source code must retain the above copyright
21 #      notice, this list of conditions and the following disclaimer.
22 #
23 #   *  Redistributions in binary form must reproduce the above copyright
24 #      notice, this list of conditions and the following disclaimer in the
25 #      documentation and/or other materials provided with the distribution.
26 #
27 #   *  Neither the name of Texas Instruments Incorporated nor the names of
28 #      its contributors may be used to endorse or promote products derived
29 #      from this software without specific prior written permission.
30 #
31 #   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
32 #   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
33 #   THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
34 #   PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
35 #   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
36 #   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
37 #   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
38 #   OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
39 #   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
40 #   OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
41 #   EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42 #############################################################
43 # $Release Name: TI-15.4Stack Linux x64 SDK$
44 # $Release Date: July 14, 2016 (2.00.00.30)$
45 #############################################################
47 hostarch=`uname -m`
50 if [ "x${hostarch}x" == "xarmv7lx" ]
51 then
52     my_arch_name=bbb
53 fi
55 if [ "x${hostarch}x" == "xx86_64x" ]
56 then
57     my_arch_name=host
58 fi
60 if [ "x${my_arch_name}x" == 'xx' ]
61 then
62     echo "Unknown Host type: ${hostarch}"
63     echo "Expected: armv7l {for BBB}"
64     echo "Expected: x86_64 {for Linux 64bit host}"
65     exit 1
66 fi
68 HERE=`pwd`
70 # Using prebuilt binaries
71 BIN_DIR=${HERE}/../prebuilt
72 # Uncomment line below to use binary built from source
73 #BIN_DIR=${HERE}/../collector
75 GATEWAY_DIR=${HERE}/../iot-gateway
77 echo "Launching the Collector Application in the background"
78 cd ${BIN_DIR}
79 bash ./run_collector.sh
80 ERR=$?
81 if [ $ERR != 0 ]
82 then
83     echo "Something seems wrong with the collector app"
84     echo "Make sure the /prebuilt/bin/bbb_collector file is executable:"
85     echo "chmod +x /prebuilt/bin/bbb_collector"
86     exit ${ERR}
87 fi
88 cd ${HERE}
92 echo "Launching Node-JS gateway application in background"
93 cd ${GATEWAY_DIR}
94 bash ./run_gateway.sh $1
95 ERR=$?
96 if [ $ERR != 0 ]
97 then
98     echo "Something seems wrong with the gateway app"
99     exit ${ERR}
100 fi
101 cd ${HERE}