Motion - Support Question 2006x 10x 19x 140357

Can SIGHUP to used to change netcam_url?

Question

I have a webcam on an ADSL connection with an IP address that changes periodically. To avoid saturating the ADSL bandwidth when more than a couple people access the webcam at the same time and to give it a seemingly fixed IP address, I set up a second instance of motion on a rented server with greater bandwidth that uses the IP-based URL of the source webcam as input and re-streams it from the server. I'm trying to automate the handling of the source webcam's IP address changes by having a cron job on that machine periodically access a CGI program on the server. That CGI program updates the motion.conf file on the server and issues a SIGHUP to the motion process whenever the IP of the client calling changes. However, at least when the server instance of motion is still trying to connect or reconnect to the source webcam, issuing the SIGHUP seems to cause motion on the server to terminate rather than re-read the config file and reconnect to the new netcam_url. Is this normal behavior or is there any way to use SIGHUP to change the effective netcam_url?

THanks in advance for any insight anyone can provide!


Environment

Motion version: 3.2.6
ffmpeg version:  
Libraries: ffmpeg, mysql
Server OS:  

-- ZibeliAton - 19 Oct 2006

Answer

It is always more difficult to get things to work with signals.

I would use the RemoteControlHttp interface instead.

Your script can restart Motion via this interface. The RemoteControlHttp shows how you can do this from a script.

I have am controlling Motion both from web applications and from cron this way and it works well and much more reliable because Motion itself decides when to restart.

Watch out for 3.2.7 about to be released very soon. It is more reliable also with Netcams.

-- KennethLavrsen - 19 Oct 2006

Thanks!

-- ZibeliAton - 20 Oct 2006

Thanks! I took you suggestion and switched to using the http interface to just change the webcam_url setting and it seems to be working fine.

Don't know why that approach didn't occur to me to begin with as I used the web interface a lot when experimenting with settings early on - I guess sometimes you just need a nudge from outside to break out of your box, so thanks again for this answer and the project as a whole.
Topic revision: r3 - 20 Oct 2006, ZibeliAton
Copyright © 1999-2024 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.