Sindbad~EG File Manager
#!/bin/sh
# 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 the port
PIDS=$(sockstat -4 -l | awk -v port=$ENGINE_PORT '$6 ~ port {print $3}') # Correct field for FreeBSD
if [ -n "$PIDS" ]; then
echo "Killing processes: $PIDS"
sudo 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 stdbuf -oL $ENGINE_BINARY 2>&1 | tee -a $LOG_FILE &
# Wait briefly to confirm it started
sleep 2
if sockstat -4 -l | grep -q ":$ENGINE_PORT"; then
echo "MathXpertEngine started successfully!"
else
echo "Failed to start MathXpertEngine. Check $LOG_FILE for details."
fi
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists