#!/bin/bash

export DISPLAY=:1
nohup  Xvfb :1 -screen 0 1024x768x16 &
sleep 1


while true; do
 
    echo "virtual_clientd Starting"
    # Start your application here
    /opt/quasar/bin/virtual_clientd

    # Check if the application exited cleanly (return code 0)
    if [ $? -eq 0 ]; then
        echo "Application exited cleanly. Restarting..."
    else
        echo "Application exited with an error. Respawning..."
    fi

    # Add a delay before respawning to avoid constant restarting
    sleep 2
done

