#!/bin/bash

# Path to your WebSocket command
SOCKET_CMD="/usr/local/bin/ea-php56 /home2/cp771140/public_html/RMT/artisan websockets:serve"

# Check if the WebSocket server is already running
if pgrep -f "websockets:serve" > /dev/null
then
    echo "WebSocket server is already running. No action needed."
else
    echo "WebSocket server is not running. Starting the server..."
    nohup $SOCKET_CMD > /dev/null 2>&1 &
    echo "WebSocket server started."
fi
