#!/bin/bash

while true
do
    echo "Starting Gunicorn server..."
    # Start Gunicorn server in the background
    gunicorn -w 4 -b 0.0.0.0:30992 sendrvnandass:app &
    # Get the PID of the Gunicorn process
    GUNICORN_PID=$!
    echo "Gunicorn server started with PID $GUNICORN_PID"

    # Wait for 60 seconds
    sleep 60

    # Stop the Gunicorn server
    echo "Stopping Gunicorn server with PID $GUNICORN_PID..."
    kill $GUNICORN_PID
    wait $GUNICORN_PID 2>/dev/null
    echo "Gunicorn server stopped"

done

