-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
48 lines (40 loc) · 1.7 KB
/
Copy pathstart.sh
File metadata and controls
48 lines (40 loc) · 1.7 KB
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
#!/bin/bash
# ──────────────────────────────────────────────
# TCP-Dumper — Start Script
# Runs the application with sensible JVM defaults.
# ──────────────────────────────────────────────
set -e
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
cd "$SCRIPT_DIR"
JAR="tcp-dumper.jar"
CONFIG="config.yml"
# Check if JAR exists
if [ ! -f "$JAR" ]; then
# Try target/ directory
SHADED_JAR=$(find target/ -name "tcp-dumper-*.jar" ! -name "*original*" 2>/dev/null | head -1)
if [ -n "$SHADED_JAR" ]; then
JAR="$SHADED_JAR"
else
echo "❌ $JAR not found. Run ./build.sh first."
exit 1
fi
fi
# Check if config exists, create default if not
if [ ! -f "$CONFIG" ]; then
echo "⚠ config.yml not found — creating default config."
echo " → Edit config.yml before restarting!"
cp config.yml.example "$CONFIG" 2>/dev/null || true
fi
# Ensure directories exist
mkdir -p captures logs
echo "╔══════════════════════════════════════╗"
echo "║ TCP-Dumper — Starting... ║"
echo "╚══════════════════════════════════════╝"
echo ""
# JVM arguments
JVM_ARGS="-Xms64m -Xmx256m"
JVM_ARGS="$JVM_ARGS -XX:+UseG1GC"
JVM_ARGS="$JVM_ARGS -XX:+HeapDumpOnOutOfMemoryError"
JVM_ARGS="$JVM_ARGS -Djava.net.preferIPv4Stack=true"
# Pass through any additional args (like --config /other/path.yml)
exec java $JVM_ARGS -jar "$JAR" --config "$CONFIG" "$@"