Dynamic remote cam url

Anything you want added or changed in future versions of ZoneMinder? Post here and there's a chance it will get in! Search to make sure it hasn't already been requested.
Post Reply
Gool
Posts: 6
Joined: Sun Mar 26, 2006 7:16 am

Dynamic remote cam url

Post by Gool »

Hello, I have cam with dynamic url (i.e. /YYYY/MM/DD/HH_MM.jpg), my bash script know about URL changing, and I can do some tricks with cronjob. I.e.:

# ...
if [ "$OLDURL" != "$NEWURL" ]; then
echo $NEWURL > $LOCKFILE
mysql -e "UPDATE Monitors SET Path = '$NEWURL' WHERE Id = $MONITOR" zm
/etc/init.d/zm restart > /dev/null
# ...

But I think must be better way for refresh configuration than (zm restart).

Regards.
Flash_
Posts: 441
Joined: Wed Jan 11, 2006 12:19 pm

Post by Flash_ »

Note I'm not a bash guru, but.. Is there any chance you could call your bash script from ZM as the image source, and the bash script maps the incoming call to the new target?

If it was a simple IP-change then playing around with /etc/hosts would help.
Gool
Posts: 6
Joined: Sun Mar 26, 2006 7:16 am

Post by Gool »

This is NOT IP changing-this is PATH changing. All work fine, but I dont know, how to submit new configuration data in ZM. I can change path in ZM MySQL database (mysql -e "UPDATE Monitors SET Path = '$NEWURL' WHERE Id = $MONITOR" zm ) but after that ZM show me OLD url, until I run /etc/init.d/zm restart.
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

The path is loaded from the DB when the process starts only. So changing it while it is running will have no effect until a restart. You might want to experiment with a script that does a relayed fetch instead acting in between ZM and your image source.
Phil
Gool
Posts: 6
Joined: Sun Mar 26, 2006 7:16 am

Post by Gool »

> So changing it while it is running will have no effect until a restart.
Ok, but when I change cam url trough web interface, and press button SAVE, ZM do restart like this?

zm:/home/gool# /etc/init.d/zm restart
Stopping ZoneMinder: success
Starting ZoneMinder: success
zm:/home/gool#

This way take some time (about ~5 sec). May be there are shotter way?
Flash_
Posts: 441
Joined: Wed Jan 11, 2006 12:19 pm

Post by Flash_ »

If you read my post again I didn't say it was ip-changing. As I said, first suggestion would be to use a script to pass on the image, mapping paths internally.

Anyway, if you can't do that - you could possibly update the mysql database from outside of Zoneminder then run a zmpkg.pl restart to force it to reload the configuration.

It's *not* quick, there'll still be a delay while ZM closes down and restarts, but it is automated.

I've not tried this but should be possible. Hopefully someone will butt in if it's a stupid idea and changing ZM's mysql values whilst it's running is bad.
Gool
Posts: 6
Joined: Sun Mar 26, 2006 7:16 am

Thanks

Post by Gool »

Thanks big, your advice have helped. All work fine even with 3d party dynamic cams (i.e ww.com) I dont have any idea how to map remote jpg stream to localhost with bash.
Post Reply