Files

20 lines
578 B
Bash
Executable File

#!/usr/bin/env bash
PORT=8091
PID_FILE="/root/projects/78649634/gasemi_tier/.server.pid"
if [ -f "$PID_FILE" ]; then
OLD_PID=$(cat "$PID_FILE")
if kill -0 "$OLD_PID" 2>/dev/null; then
kill "$OLD_PID" 2>/dev/null || true
sleep 1
fi
rm -f "$PID_FILE"
fi
# Kill any stray process on this port
fuser -k ${PORT}/tcp 2>/dev/null || true
nohup php -S 0.0.0.0:${PORT} -t /root/projects/78649634/gasemi_tier > /root/projects/78649634/gasemi_tier/server.log 2>&1 &
echo $! > "$PID_FILE"
echo "Server started on port ${PORT} with PID $(cat "$PID_FILE")"