Motion - Motion Watchdog And Cleanup Programs

motionwatchdog and motioncleanup


- motionwatchdog: an application which (re)start motion and other application automatically after a crash. Optionally it is possible to use a watchdog device.
- motioncleanup: a program which permits to erase the old pictures captured by motion. The program need the "new file" format (with directories), and motioncleanup use the directory structure to avoid the scanning of the whole pictures to find the oldest. The cleanup starts when less than a specifyed memory is available on the filesystem. It can be started in background to make a regulary cleanup.

Detailed Description

Usage:  motionwatchdog "watchdog" "command" .. "command"
        "watchdog"      Watchdog device (/dev/watchdog)
                        Use the null device is the watchdog
                        is not used (/dev/null)
                        WARNING: Using a watchdog will reboot
                        the computer if this program is killed!!!
        "command"       Commands executed in background
                        The command must be a command which
                        does not return!!!
                        NOTE: motion need to be configure
                        in non-deamon mode.

ex:     motionwatchdog /dev/null 'motion' 'motioncleanup 60 /home/CAMERA'
        Execute 'motion'
                AND restart it if motion terminates
        Execute 'motioncleanup 60 /home/CAMERA'
                AND restart it if motion terminates
        No watchdog devices are used

Usage:  motioncleanup "time" "size" "dir" ... "dir"
        "time"  Sleep time between 2 check (0 to deactivate)
        "size"  in MB which should be left on the disk
        "dir"   directory which contains the pictures captures
                by motion (new format only supported)

ex:     'motioncleanup 60 2700 /tmp/CAMERA1 /tmp/CAMERA2 /tmp/CAMERA3'
        removes every 60s the oldest pictures from /tmp/CAMERA1 /tmp/CAMERA2
        /tmp/CAMERA3 if less than 2700 MB are available.


Download: Download the pachages located (motionwatchdog.tar.gz and motioncleanup.tar.gz) at

What do you need to install before?
tar is needed. make is needed. qmake is needed. gcc is needed.

How do you install the program? (assume talking to a newbie)
tar xvfz motionwatchdog.tar.gz
tar xvfz motioncleanup.tar.gz
follow the instruction in the INSTALL file.

RelatedProjectsForm edit

ProjectSummary Small programs in C: erase the oldest pictures and restart motion on crash
ProjectStatus Beta
ReleaseVersion 1.0
ProjectSubmitter SebastienFricker
Topic revision: r2 - 15 Nov 2004, KennethLavrsen
Copyright © 1999-2023 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Please do not email Kenneth for support questions (read why). Use the Support Requests page or join the Mailing List.
This website only use harmless session cookies. See Cookie Policy for details. By using this website you accept the use of these cookies.