Send Motion-user mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.sourceforge.net/lists/listinfo/motion-user
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Motion-user digest..."
Today's Topics:
1. Re: disabling a camera with a time parameter (MrDave)
2. Re: disabling a camera with a time parameter (Richard Bown)
3. Re: Motion crashing regularly (Stewart Andreason)
4. Re: Motion crashing regularly (MrDave)
----------------------------------------------------------------------
Message: 1
Date: Mon, 23 Oct 2023 14:26:53 -0600
From: MrDave <[email protected]>
To: [email protected]
Subject: Re: [Motion-user] disabling a camera with a time parameter
Message-ID: <[email protected]>
Content-Type: text/plain; charset=UTF-8; format=flowed
On 10/23/2023 10:34 AM, Richard Bown wrote:
>
> Hi,
> I'm dong something similar to that, by tracking both my phone and my
> wifes, and if both are out or we have set a state switch we are away,
> the the lwp-request http....../pause is sent
> and if either of us are in the
> lwp-request http......../start is sent
>
>
> and also at a time in the evening the lwp-request ..../start is sent
> and the opposite in the morning
>
> the problem is its a blind command and doesn't always get actioned by
> motion, or gets lost
Other than a comment that it "should work", there is always the option
to check status.? e.g.
{IP}:{port}/{camid}/detection/status
It returns current status of the camera and would tell whether the pause
command got acted upon.
> from the logfile there is
>
>> [0:cn0] [DBG] [STR] [Oct 23 17:19:42] webu_parseurl: Sent url:
>> /101/detection/pause
>> [0:cn0] [DBG] [STR] [Oct 23 17:19:42] webu_parseurl: Decoded url:
>> /101/detection/pause
>> [0:cn0] [DBG] [STR] [Oct 23 17:19:42] webu_parseurl: camid: >101<
>> cmd1: >detection< cmd2: >pause< parm1:>< val1:>< parm2:>< val2:><
>> [0:wu0] [INF] [ALL] [Oct 23 17:19:42] webu_answer_ctrl: Connection
>> from: 127.0.0.1
>>
> I've tried running tail -f motion.log | grep Decoded url > a file
> but haven't succeeded in setting a flag that can be read by another
> application/program like homeassistant
>
> this sorta works
> tail -f /var/log/motion/motion.log | grep Decoded
> [0:cn0] [DBG] [STR] [Oct 23 17:28:40] webu_parseurl: Decoded url:
> /101/detection/pause
> [0:cn0] [DBG] [STR] [Oct 23 17:28:41] webu_parseurl: Decoded url:
> /101/detection/pause
>
> But I haven't succeeded in writing the output of grep to a file
>
> On Mon, 2023-10-23 at 09:54 -0600, MrDave wrote:
>> What I've seen is that people use a bash script that pings their
>> phone.
>> If the ping returns then disable the camera(s), if not, then turn the
>> camera(s) on.? Then use a crontab to run the script at some sort of
>> frequent interval.
>>
>> MrDave
>> On 10/23/2023 9:26 AM, Richard Bown wrote:
>>> Hi
>>> just 8 cams on my system, one really needs to be disabled during
>>> the
>>> day,
>>> At the moment I'm sending a script in homeassistant
>>>
>>> lounge_cam:
>>> ???????? command_on: 'lwp-request
>>> http://localhost:7770/101/detection/start'
>>> ???????? command_off: 'lwp-request
>>> http://localhost:7770/101/detection/pause'
>>>
>>> sorry for the line wrapping, it doesn't always work as verification
>>> is
>>> a pig to get to work,? So far I have failed ,
>>> I have logging set to 8 and I have tried to use grep to find the
>>> response to the lwp-request.
>>> If it was only just using it for a few hours at night, I could use
>>> crontab , but it also needs to be on if we are out or away from
>>> home.
>>> with 8 cameras and on log level 8 there is a lot being added to the
>>> logfile.
>>> Am I missing a simple way of doing this ???
>>>
>>
>>
>> _______________________________________________
>> Motion-user mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/motion-user
>> https://motion-project.github.io/
>>
>> Unsubscribe: https://lists.sourceforge.net/lists/options/motion-user
>
>
> _______________________________________________
> Motion-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/motion-user
> https://motion-project.github.io/
>
> Unsubscribe: https://lists.sourceforge.net/lists/options/motion-user
------------------------------
Message: 2
Date: Mon, 23 Oct 2023 22:08:43 +0100
From: Richard Bown <[email protected]>
To: [email protected]
Subject: Re: [Motion-user] disabling a camera with a time parameter
Message-ID: <[email protected]>
Content-Type: text/plain; charset="UTF-8"
On Mon, 2023-10-23 at 14:26 -0600, MrDave wrote:
>
>
>
> Other than a comment that it "should work", there is always the
> option
> to check status.? e.g.
>
> {IP}:{port}/{camid}/detection/status
>
> It returns current status of the camera and would tell whether the
> pause
> command got acted upon.
>
>
Many thanks , thats just saved me a lot of work ??
------------------------------
Message: 3
Date: Mon, 23 Oct 2023 15:22:53 -0700
From: Stewart Andreason <[email protected]>
To: Motion-user <[email protected]>
Subject: Re: [Motion-user] Motion crashing regularly
Message-ID: <[email protected]>
Content-Type: text/plain; charset="utf-8"; Format="flowed"
Hi,
At least your log has some kind of message, since my random crashes
leave no message.
I've resorted to running a perl script program that watches defined
directories snapshot file for lack of updating, and send out udp alert
to me, and I end up doing the service motion stop and start others have
mentioned today.
It's been 2.6 years since I last reported on this myself, but recently I
had motion crash right after I sent a configure command by http from my
control program, changing the mask, and doing a single camera restart to
reload it. Right there it went down, which also stopped the other 2
cameras the pi4 was running.
I have also a few times when starting a mpv or mplayer of that camera,
it refused to start the rtsp stream, and wonder if motion can handle a
camera that refuses to restart the stream, maybe refusing the password
for some unfathomable reason.
So is the handling different doing a restart from doing a fresh start?
Thanks,
Stewart
On 10/23/23 02:42, Ian Smith wrote:
>
> On a regular basis, the software crashes. Ideally, I would like to
> understand why, and eliminate the problem - if that isn't possible, I
> would like it to automatically restart on crashing, but I don't know
> how to do that, so any help would be appreciated.
>
-------------- next part --------------
An HTML attachment was scrubbed...
------------------------------
Message: 4
Date: Mon, 23 Oct 2023 17:00:31 -0600
From: MrDave <[email protected]>
To: [email protected]
Subject: Re: [Motion-user] Motion crashing regularly
Message-ID: <[email protected]>
Content-Type: text/plain; charset="utf-8"; Format="flowed"
On 10/23/2023 1:26 PM, Dougie Nisbet wrote:
>
>
> On 23/10/2023 10:42, Ian Smith wrote:
>>
>>
>> Once more, I suspect the issue I am facing is by my doing something
>> wrong, but any assistance would be appreciated.
>>
>> I run Motion on Ubuntu 20.04, with multiple cameras, of which one is
>> a USB camera (which may not be relevant).
>>
>> I run logging - at level 9 (all).
>>
>> On a regular basis, the software crashes. Ideally, I would like to
>> understand why, and eliminate the problem - if that isn't possible, I
>> would like it to automatically restart on crashing, but I don't know
>> how to do that, so any help would be appreciated.
>>
>> The log provides the following as an example - in the seconds leading
>> up to the crash:-
>>
>> [0:motion] [ERR] [ALL] [Oct 23 10:13:39] motion_watchdog: Thread
>> 7 - Watchdog timeout. Trying to do a graceful restart
>> [0:motion] [ERR] [ALL] [Oct 23 10:13:49] motion_watchdog: Thread
>> 7 - Watchdog timeout did NOT restart, killing it!
>>
>
> When I've had these type of messages it's been due to either hardware
> problems or overloading the (usually) rpi - i.e. Two USB webcams on
> one rpi. Funnily enough I've just had it recently and it was a faulty
> camera module. It took me a while to diagnose because the camera and
> cable looked fine, and I swapped them both, and they still failed.
> Only when I swapped them with the module on a working rpi that I noticed.
>
> As for automatically restarting motion if it crashes, I found some old
> code that I used to run every few minutes from cron, that allowed me
> to kill and restart motion remotely using a dropbox file. (I used to
> start motion when it wasn't running, now I rely on system startup and
> a daily restart via cron. It seems to work better for me.)
>
> I used to use something along the lines of:
>
> wf1=/home/dougie/tmp/$(basename -- $0)_1.$$
>
> if ps -C motion > $wf1 2>&1
> then
> ?? ?ps -C motion > /tmp/.motion.is.running
> else
> ?? ?cat $wf1 | mail -s "INFO: Starting motion - $(basename --
> $0)[$LINENO] [PID $$] - " -r "<sys-$(hostname)@katsura.uk>"
> [email protected]
> ?? ?nohup motion > /home/dougie/logs/motion.log 2>&1 &
> fi
>
> Depending on your version of Linux/bash perhaps something like 'pgrep'
> in a script might work better than the way I've done it, using ps -C.
> If I'm trying to do something like this nowadays I'd look at using
> something like pkill and pgrep to check and restart motion. I always
> run motion as myself and not as user 'motion' btw.
>
> (I saw another question about disabling motion using a time parameter
> - this doesn't do that but I find the 'rclone' command with dropbox
> pretty useful. If you use dropbox of course :-) Here's the code I use.)
>
>
> wf1=/home/dougie/tmp/$(basename -- $0)_1.$$
> #
> #??? Check Dropbox to see if motion should be stopped
> #
> if rclone cat remote:etc/stop-motion-running.txt | grep -q ^yes
> then
> ?? ?if ps -C motion > /dev/null 2>&1
> ?? ?then
> ?? ???? cat $wf1 | mail -s "INFO: Stopping motion - $(basename --
> $0)[$LINENO] [PID $$] - " -r "<sys-$(hostname)@katsura.uk>"
> [email protected]
> ?? ???? rm /tmp/.motion.is.running >> $wf1 2>&1
> ?? ???? pkill -u dougie motion
> ?? ???? sleep 10
> ?? ???? pkill -9 -u dougie motion
> ?? ?fi
> fi
>
>
>
For additional diagnosing, what you want to do is go up in the log and
determine what "thread 7" (in your log example) was trying to do before
it entered into a "non-responsive" state.? (For reference, the watchdog
timeout means Motion was trying to do something and it took too long).?
Some things I've seen causing this are writing to mounted drives/devices
and other applications interfering with the v4l2 camera.
>
>
> _______________________________________________
> Motion-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/motion-user
> https://motion-project.github.io/
>
> Unsubscribe:https://lists.sourceforge.net/lists/options/motion-user
-------------- next part --------------
An HTML attachment was scrubbed...
------------------------------
------------------------------
Subject: Digest Footer
_______________________________________________
Motion-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/motion-user
------------------------------
End of Motion-user Digest, Vol 206, Issue 4
*******************************************