Sindbad~EG File Manager
#!/bin/sh
# Define Engine details
ENGINE_PORT=12349
RESTART_SCRIPT="/home/beeson/MathXpert/bin/restartEngine.sh"
LOG_FILE="/home/beeson/MathXpert/logs/chron.log"
# Check if anything is listening on the port
if sockstat -4 -l | grep -q ":$ENGINE_PORT"; then
echo "MathXpertEngine is running."
# Check if there are active connections
CONNECTIONS=$(sockstat -4 -c | awk -v port="$ENGINE_PORT" '$6 ~ port {print $3}')
if [ -n "$CONNECTIONS" ]; then
echo "Active connections: $CONNECTIONS"
else
echo "No active connections."
fi
else
echo "MathXpertEngine is NOT running. Restarting..."
# Log the restart event with a timestamp
echo "Restarted by checkEngine at $(date '+%Y-%m-%d %H:%M:%S')" >> "$LOG_FILE"
# Restart the Engine
sh "$RESTART_SCRIPT"
fi
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists