Starting/Stopping ZM from a script

Support and queries relating to all previous versions of ZoneMinder
Locked
richbl
Posts: 8
Joined: Sun Aug 03, 2008 4:37 am

Starting/Stopping ZM from a script

Post by richbl »

Hello all,

I'm getting up to speed with ZM, and so far, I have managed the following:

--Logitech WebCam (QuickCam Communicate STX) up and running using mjpg_streamer
--Linksys IPCam (WVC54GCA)
--Image delivery via email on motion detect (see thread at http://www.zoneminder.com/forums/viewtopic.php?t=11964)

What I'd now like to do is start/stop ZM via a bash script so that it's easy for me to enable/disable my security system.

A first cut on a very basic script would look like the following:

Code: Select all

#!/bin/sh
mjpg_streamer -i "input_uvc.so -r 320x240 -f 15" -o "output_http.so" -b
sudo zmu -m 1 -E
sudo zmu -m 5 -E
Then, to disable everything, I'd like to run a script like this:

Code: Select all

#!/bin/sh
killall mjpg_streamer
sudo zmu -m 1 -D
sudo zmu -m 5 -D
But, I'm running into a problem. Whenever I attempt to enable the webcam VIA SCRIPT, I cannot seem to get it to generate any activity. If I go into the ZM UI, and manually change the webcam funtion from modetect to none, and then back to modetect, the webcam starts working. Clearly, this is not expected behavior.

So, I have two questions:

A) Has anyone encountered problems enabling their monitor (in this case, a webcam) from command line (zmu)? Is there a way on CLI to change monitor function (from say, none to modetect)?

B) Is there a better approach to accomplishing what I want to do, that is, start/stop my ZM security system from a script?


Thanks much.

rich
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

Using the run states might serve you better.

http://www.zoneminder.com/forums/viewtopic.php?p=13102
richbl
Posts: 8
Joined: Sun Aug 03, 2008 4:37 am

Post by richbl »

cordel wrote:Using the run states might serve you better.

http://www.zoneminder.com/forums/viewtopic.php?p=13102
Excellent. I just learned something new!

Works like a charm.

Thanks much.
Locked