Page 1 of 1
how do I find current run state ?
Posted: Sun Dec 09, 2012 7:11 pm
by hoolahoous
I am writing a shell script which will change the run state of zoneminder (basically will start/stop motion detection on all cameras). That script will first ping ip address of my cell phone (connected on local wifi network), if it can't ping it then it will start motion detection. if ping succeeds then it will turn off motion detection. here is my problem, i don't want to call zmpkg to switch the state if it is already in same state (i.e. if motion detection is already off then it won't try to switch it off and vice versa).
but i can't find a way to find out current run state. how do i find the current run state ?
Re: how do I find current run state ?
Posted: Mon Dec 10, 2012 12:51 am
by theforce
I took a quick look at the run states and I dont see where it loggs what state its currently in. From the way it looks when you create a run state all it does is change the state of the monitors and thats it. Someone else with more knowledge than me can chime in here with a definite answer.
If it does not record the run state you could always add a table to the database for the state that ZM is in. Then in your script you can update the database with the run state and also call it to see the curent run state. Should be pretty simple to do if you know how to manipulate the database.
Is there a reason you cant send the commands to turn them on if they are on or off if they are off? I have not used this feature yet but I have some ideas for it.
Re: how do I find current run state ?
Posted: Mon Dec 10, 2012 11:47 am
by bb99
Top center of index (home) page. Will say something similar to running or stopped, etc. Click on it and another window will open allowing you to change it.
Re: how do I find current run state ?
Posted: Mon Dec 10, 2012 11:03 pm
by theforce
You can chage that but it does not say what state its currently in. At lease for me it only says "stopped" or "running". If I change to state "test" it will only show running at the top of the page. I dont see anything in the database that stores the current run state so you can call it later.
Re: how do I find current run state ?
Posted: Tue Dec 11, 2012 4:37 pm
by hoolahoous
exactly. no way to find out what 'current' state is.
Re: how do I find current run state ?
Posted: Wed Dec 12, 2012 2:13 pm
by PatMcLJr
dunno,
running ubuntu ?
sudo service zoneminder status
but I don't think that will tell you if the cameras are working, guess you would also need to check mysql and apache to see if they are running as well
Re: how do I find current run state ?
Posted: Thu Dec 13, 2012 8:21 pm
by hoolahoous
PatMcLJr wrote:dunno,
running ubuntu ?
sudo service zoneminder status
but I don't think that will tell you if the cameras are working, guess you would also need to check mysql and apache to see if they are running as well
yes running ubuntu. Script i am writing, will run every 5 minutes and check if I am at home. if I am at home it will disable the motion detection otherwise it will enable it.
your suggestion will tell if sevice itself is running on not. I am trying to find out zm is in motion detection state or not. Since zm state change requires several seconds I am trying to not change run state if it is already in same state.