-
Notifications
You must be signed in to change notification settings - Fork 1
/
run_collector.sh
executable file
·91 lines (76 loc) · 1.98 KB
/
run_collector.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/bin/bash
#############################################################
# @file run_collector.sh
#
# @brief TIMAC 2.0 run_collector.sh, used by run_demo.sh to launch collector
#
# Group: WCS LPC
# $Target Device: DEVICES $
#
#############################################################
# $License: BSD3 2016 $
#############################################################
# $Release Name: PACKAGE NAME $
# $Release Date: PACKAGE RELEASE DATE $
#############################################################
# Because this is a "quick demo" we hard code
# the device name in this check. For a production
# application, a better check is suggested.
#
#if [ ! -c /dev/ttyACM0 ]
#then
# echo ""
# echo "The Launchpad (/dev/ttyACM0) does not seem to be present"
# echo ""
# exit 1
#fi
# This test is simple...
arch=`uname -m`
#if [ "x${arch}x" == 'xx86_64x' ]
#then
exe=host_collector
#fi
#if [ "x${arch}x" == 'xarmv7lx' ]
#then
# ---------
# This script has no way to determine how you built
# the application.
# --------
# This script assumes that you have built the "collector"
# application via the a cross compiler method and not
# built natively on the BBB
# ---------
# If you build natively on the BBB, then the BBB
# is actually the HOST... and thus the application is
# "host_collector"
# exe=bbb_collector
#fi
if [ "x${exe}x" == "xx" ]
then
echo "Cannot find Collector App exe: $exe"
exit 1
fi
if [ ! -x $exe ]
then
echo "Cannot find EXE $exe"
exit 1
fi
PID=`pidof $exe`
if [ "x${PID}x" != "xx" ]
then
kill -9 ${PID}
fi
# by default, the application uses the name: "collector.cfg" as the configuration file
# or you can pass the name of the configuration file on the command line
./$exe collector.cfg &
PID=$!
# Wait 3 seconds for it to get started ...
sleep 3
if ps -p $PID > /dev/null
then
echo "Collector Running as Process id: ${PID}"
exit 0
else
echo "Error starting collector application"
exit 1
fi