Page 1 of 1

Dynamic remote cam url

Posted: Sun Mar 26, 2006 7:37 am
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.

Posted: Sun Mar 26, 2006 9:40 am
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.

Posted: Mon Mar 27, 2006 1:16 pm
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.

Posted: Mon Mar 27, 2006 10:15 pm
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.

Posted: Tue Mar 28, 2006 6:00 am
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?

Posted: Tue Mar 28, 2006 7:00 am
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.

Thanks

Posted: Tue Mar 28, 2006 11:44 am
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.