-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathprobe.sh
executable file
·86 lines (73 loc) · 1.79 KB
/
probe.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/sh
#
run_command() {
if command -v sudo &>/dev/null; then
sudo "$@"
else
"$@"
fi
}
if [ -f "scripts/setup_env.sh" ]; then
source scripts/setup_env.sh
elif [ -f "/opt/rsprobe/bin/setup_env.sh" ]; then
source /opt/rsprobe/bin/setup_env.sh
fi
if [ -f ".env" ]; then
source "./.env"
fi
if [ "$OUTPUT_FILE" == "" ]; then
OUTPUT_FILE=images/test.jpg
fi
if [ "$KAFKA_BROKER" == "" ]; then
KAFKA_BROKER=localhost:9092
fi
if [ "$RUST_BACKTRACE" == "" ]; then
BACKTRACE=full
fi
if [ "$BUILD" == "" ]; then
BUILD=release-with-debug
fi
if [ "$GST_DEBUG_LEVEL" == "" ]; then
GST_DEBUG_LEVEL=1
fi
if [ "$SOURCE_IP" == "" ]; then
SOURCE_IP=224.0.0.200
fi
if [ "$SOURCE_DEVICE" == "" ]; then
SOURCE_DEVICE=eth0
fi
if [ "$SOURCE_PORT" == "" ]; then
SOURCE_PORT=10000
fi
if [ -f "target/$BUILD/probe" ]; then
PROBE_BIN=target/$BUILD/probe
elif [ -f "$PREFIX/bin/probe" ]; then
PROBE_BIN=$PREFIX/bin/probe
else
echo "No probe binary found in $PREFIX/bin or target/$BUILD/"
exit 1
fi
EXTRACT_IMAGES_ARG=
#EXTRACT_IMAGES_ARG=--extract-images
echo "Using $PROBE_BIN"
$PROBE_BIN -V
#VALGRIND="valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --log-file=valgrind.log "
CPU_BIND=0
MEM_BIND=0
# NUMACTL="numactl --cpubind=$CPU_BIND --membind=$MEM_BIND"
# --kafka-broker $KAFKA_BROKER \
#run_command \ #FIXME
GST_PLUGIN_PATH=$GST_PLUGIN_PATH \
LD_LIBRARY_PATH=$LD_LIBRARY_PATH \
GST_DEBUG=$GST_DEBUG_LEVEL \
RUST_BACKTRACE=$BACKTRACE \
RUST_LOG=$RUST_LOG \
$VALGRIND $NUMACTL $PROBE_BIN \
$EXTRACT_IMAGES_ARG \
--source-device $SOURCE_DEVICE \
--pcap-stats \
--source-ip $SOURCE_IP \
--source-port $SOURCE_PORT \
--kafka-topic "rsprobe" \
--output-file $OUTPUT_FILE \
$@