Sindbad~EG File Manager
#!/bin/zsh
# Define Engine details
ENGINE_PORT=12349
ENGINE_BINARY="./MathXpertEngine"
LOG_FILE="engine.log"
echo "Stopping any existing MathXpertEngine processes on port $ENGINE_PORT..."
# Find and kill processes using sockstat (FreeBSD)
PIDS=$(sockstat -4 -l | awk -v port=$ENGINE_PORT '$3 ~ port {print $2}') # Fixed column reference
if [ -n "$PIDS" ]; then
echo "Killing processes: $PIDS"
kill -9 $PIDS
sleep 2 # Give time for processes to terminate
else
echo "No running processes found on port $ENGINE_PORT."
fi
# Verify if process is truly stopped
if sockstat -4 -l | grep -q ":$ENGINE_PORT"; then
echo "Error: MathXpertEngine is still running. Try manually killing it."
exit 1
fi
# Start the Engine in the background and log output
echo "Starting MathXpertEngine..."
nohup $ENGINE_BINARY >> $LOG_FILE 2>&1 &
disown
# Wait briefly to confirm it started
sleep 2
if sockstat -4 -l
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists