-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathentrypoint.sh
More file actions
39 lines (25 loc) · 1.11 KB
/
entrypoint.sh
File metadata and controls
39 lines (25 loc) · 1.11 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
#!/bin/bash
LOG_DIR="/logs"
mkdir -p "$LOG_DIR"
LOG_FILE="${LOG_DIR}/sqlancer.log"
echo "=== SQLancer container start ==="
echo "Waiting for DB to become healthy..."
cd /root/sqlancer/target || { echo "Missing target directory"; exit 1; }
# Wait for the DB container to become healthy
for i in {1..60}; do
STATUS=$(docker inspect --format='{{.State.Health.Status}}' "$SQLANCER_HOST" 2>/dev/null || echo "unknown")
if [ "$STATUS" = "healthy" ]; then
break
fi
sleep 1
done
CMD="java -jar sqlancer-*.jar --num-threads \"$SQLANCER_THREADS\" --timeout-seconds \"$SQLANCER_TIMEOUT\" --host \"$SQLANCER_HOST\" \"$SQLANCER_DBMS\" --oracle \"$SQLANCER_ORACLE\""
if [ "$(printf '%s' "${SQLANCER_USERNAME:-}" | tr '[:lower:]' '[:upper:]')" != "N/A" ]; then
CMD="$CMD --username \"$SQLANCER_USERNAME\""
fi
if [ "$(printf '%s' "${SQLANCER_PASSWORD:-}" | tr '[:lower:]' '[:upper:]')" != "N/A" ]; then
CMD="$CMD --password \"$SQLANCER_PASSWORD\""
fi
echo "Running: $CMD" | tee -a "$LOG_FILE"
eval "$CMD" 2>&1 | tee -a "$LOG_FILE" | grep --line-buffered "Executed"
echo "[INFO] SQLancer finished. Logs saved to $LOG_DIR"