Skip to content

Commit 465581d

Browse files
committed
System Touch
1 parent 446bd5c commit 465581d

15 files changed

Lines changed: 186 additions & 0 deletions

scripts/bash/test.49111.check.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
# Test: Check if port 49111 is open and accepting TCP connections
3+
HOST="${1:-localhost}"
4+
PORT=49111
5+
6+
if timeout 3 bash -c "echo >/dev/tcp/$HOST/$PORT" 2>/dev/null; then
7+
echo "[PASS] Port $PORT is open on $HOST."
8+
else
9+
echo "[FAIL] Port $PORT not reachable on $HOST."
10+
exit 1
11+
fi

scripts/bash/test.49111.close.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env bash
2+
# Test: Connect to port 49111 and close cleanly via quit
3+
HOST="${1:-localhost}"
4+
PORT=49111
5+
6+
RESPONSE=$(printf "quit\n" | timeout 5 nc -w 5 "$HOST" "$PORT" 2>/dev/null || true)
7+
8+
echo "[PASS] Connection closed on $HOST:$PORT."
9+
[ -n "$RESPONSE" ] && echo "$RESPONSE" | head -5

scripts/bash/test.49111.connect.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
# Test: Start a connection to port 49111 and verify banner/response
3+
HOST="${1:-localhost}"
4+
PORT=49111
5+
6+
RESPONSE=$(echo "" | timeout 5 nc -w 5 "$HOST" "$PORT" 2>/dev/null || true)
7+
8+
if [ -n "$RESPONSE" ]; then
9+
echo "[PASS] Connected to $HOST:$PORT. Response:"
10+
echo "$RESPONSE" | head -10
11+
else
12+
echo "[FAIL] No response from $HOST:$PORT."
13+
exit 1
14+
fi
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
# Test: Check for existing established connections on port 49111
3+
PORT=49111
4+
5+
ESTABLISHED=$(ss -tn state established "( sport = :$PORT or dport = :$PORT )" 2>/dev/null || \
6+
netstat -tn 2>/dev/null | grep ":$PORT " | grep ESTABLISHED)
7+
8+
if [ -n "$ESTABLISHED" ]; then
9+
COUNT=$(echo "$ESTABLISHED" | wc -l)
10+
echo "[PASS] $COUNT established connection(s) on port $PORT:"
11+
echo "$ESTABLISHED"
12+
else
13+
echo "[INFO] No established connections on port $PORT."
14+
fi
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
# Test: Connect to port 49111 and send settings/status commands
3+
HOST="${1:-localhost}"
4+
PORT=49111
5+
6+
RESPONSE=$(printf "status\nlang en\nquit\n" | timeout 5 nc -w 5 "$HOST" "$PORT" 2>/dev/null || true)
7+
8+
if [ -n "$RESPONSE" ]; then
9+
echo "[PASS] Settings commands accepted. Response:"
10+
echo "$RESPONSE"
11+
else
12+
echo "[FAIL] No response from $HOST:$PORT."
13+
exit 1
14+
fi

scripts/bash/test.49122.check.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
# Test: Check if port 49122 is open and accepting TCP connections
3+
HOST="${1:-localhost}"
4+
PORT=49122
5+
6+
if timeout 3 bash -c "echo >/dev/tcp/$HOST/$PORT" 2>/dev/null; then
7+
echo "[PASS] Port $PORT is open on $HOST."
8+
else
9+
echo "[FAIL] Port $PORT not reachable on $HOST."
10+
exit 1
11+
fi

scripts/bash/test.49122.close.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env bash
2+
# Test: Connect to port 49122 and close cleanly via quit
3+
HOST="${1:-localhost}"
4+
PORT=49122
5+
6+
RESPONSE=$(printf "quit\n" | timeout 5 nc -w 5 "$HOST" "$PORT" 2>/dev/null || true)
7+
8+
echo "[PASS] Connection closed on $HOST:$PORT."
9+
[ -n "$RESPONSE" ] && echo "$RESPONSE" | head -5

scripts/bash/test.49122.connect.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
# Test: Start a connection to port 49122 and verify banner/response
3+
HOST="${1:-localhost}"
4+
PORT=49122
5+
6+
RESPONSE=$(echo "" | timeout 5 nc -w 5 "$HOST" "$PORT" 2>/dev/null || true)
7+
8+
if [ -n "$RESPONSE" ]; then
9+
echo "[PASS] Connected to $HOST:$PORT. Response:"
10+
echo "$RESPONSE" | head -10
11+
else
12+
echo "[FAIL] No response from $HOST:$PORT."
13+
exit 1
14+
fi
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
# Test: Check for existing established connections on port 49122
3+
PORT=49122
4+
5+
ESTABLISHED=$(ss -tn state established "( sport = :$PORT or dport = :$PORT )" 2>/dev/null || \
6+
netstat -tn 2>/dev/null | grep ":$PORT " | grep ESTABLISHED)
7+
8+
if [ -n "$ESTABLISHED" ]; then
9+
COUNT=$(echo "$ESTABLISHED" | wc -l)
10+
echo "[PASS] $COUNT established connection(s) on port $PORT:"
11+
echo "$ESTABLISHED"
12+
else
13+
echo "[INFO] No established connections on port $PORT."
14+
fi
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
# Test: Connect to port 49122 and send settings/status commands
3+
HOST="${1:-localhost}"
4+
PORT=49122
5+
6+
RESPONSE=$(printf "status\nlang en\nquit\n" | timeout 5 nc -w 5 "$HOST" "$PORT" 2>/dev/null || true)
7+
8+
if [ -n "$RESPONSE" ]; then
9+
echo "[PASS] Settings commands accepted. Response:"
10+
echo "$RESPONSE"
11+
else
12+
echo "[FAIL] No response from $HOST:$PORT."
13+
exit 1
14+
fi

0 commit comments

Comments
 (0)