#!/bin/bash


logFile=/home/root/camera/camera.log
valid=1

while :
do
	sleep 60
	count=`ps aux | grep "/home/root/camera/camera" | grep -v "grep" | wc -l`
	time=`date '+%Y-%m-%d %H:%M:%S'`
	if [ $count -ne $valid ]
	then
		echo "$time restart due to process count($count) != $valid, restart " >> $logFile
		/home/root/camera/start.sh &
	else
		echo "$time camera process count($count) is valid, do nothing" >> $logFile
	fi
done

