camera control script design question

Forum for questions and support relating to the 1.30.x releases only.
Locked
alabamatoy
Posts: 349
Joined: Sun Jun 05, 2016 2:53 pm

camera control script design question

Post by alabamatoy »

I have a camera that sometimes needs to be rebooted. I have a camera control script which correctly reboots the camera. But of course when I do this, it causes the monitor to crash and hundreds of log entries (buffer overflow) get written as a result. Manually turning off the monitor via the console before the reboot is not possible because then I cannot access the control page.

Question: How can I turn off the monitor from within the control script, then turn it back on again after the reboot?
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: camera control script design question

Post by knight-of-ni »

From your script:
1) Send API command to stop the monitor
2) send reboot command to the camera
3) Send API start command only after the camera is back online.

See the documentation for the zm API:
https://zoneminder.readthedocs.io/en/stable/api.html

Here is a bit a code from a bash script I use to check if one of my ip cameras is up:

Code: Select all

CURL="/usr/bin/curl"
stop=0
# Stay in a loop forever until the first camera responds
while [ "$stop" -ne "1" ]; do
    $CURL -o /dev/null --silent --head "http://192.168.1.89"
    result="$?"

    if [ "$result" -eq "0" ]; then
        stop=1
    else
        echo "No response from camera. Waiting..."
        sleep 1
    fi
done
Naturally, replace the ip address with the ip of your camera
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
Locked