#!/bin/sh

APP_NAME="./cameraServer"

check_app_status() {
    pgrep -x $APP_NAME > /dev/null
}

while true
do
    if check_app_status
    then
        echo "$APP_NAME is running."
    else
        echo "$APP_NAME is not running. Restarting app..."
		cd /usr/cameraServer
		./run.sh &
    fi
    sleep 10
done

