From 322642cfa45fbeb73c54cffd180fd1be27220922 Mon Sep 17 00:00:00 2001 From: Calin Crisan Date: Thu, 7 Apr 2016 21:49:46 +0300 Subject: [PATCH] motioneye watcher can now be disabled via watch.conf --- board/common/overlay/etc/init.d/S85motioneye | 19 +++++++++++++------ board/common/overlay/etc/watch.conf | 3 +++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/board/common/overlay/etc/init.d/S85motioneye b/board/common/overlay/etc/init.d/S85motioneye index ec78910eee..4ff55d5b33 100755 --- a/board/common/overlay/etc/init.d/S85motioneye +++ b/board/common/overlay/etc/init.d/S85motioneye @@ -3,7 +3,10 @@ sys_conf="/etc/motioneye.conf" conf="/data/etc/motioneye.conf" motion_conf="/data/etc/motion.conf" -watch_timeout=120 +watch_conf="/data/etc/watch.conf" + +meyewatch_timeout=120 +meyewatch_disable="" dev_v4l_by_id="/dev/v4l/by-id/" media_dir="/data/output" @@ -13,6 +16,8 @@ fi test -f "$conf" || exit 0 +test -r $watch_conf && source $watch_conf + test -n "$os_version" || source /etc/init.d/base opts=$(cat "$conf" | while read line; do echo "--$line"; done) @@ -29,10 +34,10 @@ watch() { if responsive; then count=0 else - if [ $count -lt $watch_timeout ]; then + if [ $count -lt $meyewatch_timeout ]; then count=$(($count + 5)) else - logger -t motioneye -s "not responding for $watch_timeout seconds, rebooting" + logger -t motioneye -s "not responding for $meyewatch_timeout seconds, rebooting" reboot fi fi @@ -71,9 +76,9 @@ start() { break fi - if [ $count -gt $watch_timeout ]; then + if [ $count -gt $meyewatch_timeout ]; then msg_fail - reboot + test -z "$meyewatch_disable" && reboot return 1 fi @@ -100,7 +105,9 @@ start() { done fi - watch & + if [ -z "$meyewatch_disable" ]; then + watch & + fi msg_done } diff --git a/board/common/overlay/etc/watch.conf b/board/common/overlay/etc/watch.conf index 49f1090a91..22968f58cb 100644 --- a/board/common/overlay/etc/watch.conf +++ b/board/common/overlay/etc/watch.conf @@ -10,3 +10,6 @@ netwatch_retries=3 netwatch_timeout=5 netwatch_interval=20 +#meyewatch_disable=yes +meyewatch_timeout=120 +