-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
32 lines (26 loc) · 754 Bytes
/
start.sh
File metadata and controls
32 lines (26 loc) · 754 Bytes
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
#!/bin/bash
# Start SSH service with error checking
if ! service ssh start; then
echo "ERROR: Failed to start SSH service" >&2
exit 1
fi
# Verify SSH is actually listening (using netstat or process check)
sleep 2
if pgrep -x sshd > /dev/null; then
echo "✓ SSH service started successfully"
else
echo "ERROR: SSH service not running" >&2
exit 1
fi
# Start Flask web application as ctfuser with logging
su - ctfuser -c "cd /home/ctfuser/web && python3 app.py 2>&1 | tee -a ~/flask.log" &
FLASK_PID=$!
# Wait for Flask to start
sleep 2
echo "✓ Flask application started (PID: $FLASK_PID)"
# Monitor Flask process
while kill -0 $FLASK_PID 2>/dev/null; do
sleep 5
done
echo "ERROR: Flask application has crashed!" >&2
exit 1