From: Calin Crisan Date: Thu, 24 Nov 2016 13:06:59 +0000 (+0200) Subject: added motion_restart_on_errors setting to control if motion is restarted upon errors... X-Git-Url: http://www.vanbest.org/gitweb/?a=commitdiff_plain;h=812ca19d0bc3f2165be1bdcad81c3d0c9edbcb6e;p=motioneye-debian added motion_restart_on_errors setting to control if motion is restarted upon errors (defaulting to false) --- diff --git a/extra/motioneye.conf.sample b/extra/motioneye.conf.sample index 43a860f..3271e26 100644 --- a/extra/motioneye.conf.sample +++ b/extra/motioneye.conf.sample @@ -42,6 +42,9 @@ mount_check_interval 300 # interval in seconds at which motionEye checks if motion is running motion_check_interval 10 +# whether to restart the motion daemon when an error occurs while communicating with it +motion_restart_on_errors false + # interval in seconds at which the janitor is called # to remove old pictures and movies cleanup_interval 43200 diff --git a/motioneye/mjpgclient.py b/motioneye/mjpgclient.py index 7e4231f..1c3199e 100644 --- a/motioneye/mjpgclient.py +++ b/motioneye/mjpgclient.py @@ -72,9 +72,10 @@ class MjpgClient(IOStream): logging.error('connection problem detected for mjpg client for camera %(camera_id)s on port %(port)s' % { 'port': self._port, 'camera_id': self._camera_id}) - motionctl.stop(invalidate=True) # this will close all the mjpg clients - motionctl.start(deferred=True) - + if settings.MOTION_RESTART_ON_ERRORS: + motionctl.stop(invalidate=True) # this will close all the mjpg clients + motionctl.start(deferred=True) + MjpgClient._last_erroneous_close_time = now def _check_error(self): @@ -293,8 +294,9 @@ def _garbage_collector(): logging.error('mjpg client timed out receiving data for camera %(camera_id)s on port %(port)s' % { 'camera_id': camera_id, 'port': port}) - motionctl.stop(invalidate=True) # this will close all the mjpg clients - motionctl.start(deferred=True) + if settings.MOTION_RESTART_ON_ERRORS: + motionctl.stop(invalidate=True) # this will close all the mjpg clients + motionctl.start(deferred=True) break diff --git a/motioneye/settings.py b/motioneye/settings.py index ff442c4..6265064 100644 --- a/motioneye/settings.py +++ b/motioneye/settings.py @@ -71,6 +71,9 @@ MOUNT_CHECK_INTERVAL = 300 # interval in seconds at which motionEye checks if motion is running MOTION_CHECK_INTERVAL = 10 +# whether to restart the motion daemon when an error occurs while communicating with it +MOTION_RESTART_ON_ERRORS = False + # interval in seconds at which the janitor is called # to remove old pictures and movies CLEANUP_INTERVAL = 43200