-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathShapes
executable file
·62 lines (55 loc) · 1.62 KB
/
Shapes
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
#!/bin/sh
#******************************************************************************
# (C) Copyright 2020-2022 Real-Time Innovations, Inc. All rights reserved.
#
# The use of this software is governed by the terms specified in the
# RTI Labs License Agreement, available at https://www.rti.com/terms/RTILabs.
#
# By accessing, downloading, or otherwise using this software, you agree to
# be bound by those terms.
#*****************************************************************************
#
# Emulate all the interfaces of the Shapes service using
# rtiddsprototyper with Lua to write dummy data.
#
# USAGE:
# $DATABUSHOME/bin/run Shapes ./bin/shapes [domainId]
#*****************************************************************************
if [ "${NDDSHOME}" = "" ]; then echo "NDDSHOME Undefined!" ; exit 1; fi
# Arguments
DOMAIN_ID=${1:-0}
# Service Components to launch
COMPONENTS=""
COMPONENTS+=" Shapes::Pub "
COMPONENTS+=" Shapes::Sub "
COMPONENTS+=" Shapes::PubSub "
echo "COMPONENTS = $COMPONENTS"
# Launch the components emulated using Lua
i=0
for component in ${COMPONENTS}
do
echo "$component"
$NDDSHOME/bin/rtiddsprototyper \
-luaOnData 0 \
-luaFile src/utils/Publisher.lua \
-domainId ${DOMAIN_ID} \
-cfgName $component &
COMPONENT_PID[$i]=$!
echo " PID = ${COMPONENT_PID[$i]}"
i=$((i+1))
done
# wait for the user to terminate this shell process
while :
do
sleep 1
done
# Kill the components
trap "{
i=0
for component in ${COMPONENTS}
do
echo "Killing: $component, PID = ${COMPONENT_PID[$i]}"
kill -9 ${COMPONENT_PID[$i]}
i=$((i+1))
done
}" EXIT