diff --git a/othersoft/install.sh b/othersoft/install.sh index 8803da0..8a80f2e 100644 --- a/othersoft/install.sh +++ b/othersoft/install.sh @@ -29,5 +29,8 @@ cd ../ cd ../../ cp -r ./html/* /var/www/html chmod +x /var/www/html/php/*.sh - +cd ./build +cp TowerOptoSifAndSpectral /home/pi/bin +cd ../ +cp ./root/Mywathdog.sh /root #tc diff --git a/root/Mywathdog.sh b/root/Mywathdog.sh new file mode 100644 index 0000000..9cda7e9 --- /dev/null +++ b/root/Mywathdog.sh @@ -0,0 +1,28 @@ +#!/bin/sh +while true +do + time=`date +%H:%M:%S` + echo $time + if [[ "$time" > "01:00:01" ]] && [[ "$time" < "22:30:00" ]] + then + ps -ef | grep "TowerOptoSifAndSpectral" | grep -v "grep" + if [ "$?" -eq 1 ] + then + /home/pi/bin/TowerOptoSifAndSpectral & + echo "process has been restarted!" > /home/data/log.txt + else + echo "process already started!" + sleep 60 + fi + else + ps -ef | grep "TowerOptoSifAndSpectral" | grep -v "grep" + if [ "$?" -eq 1 ] + then + sleep 60 + else + echo "time to kill the task" > /home/data/log.txt + pkill TowerOptoSifAndSpectral + fi + fi + sleep 30 +done