how do I find current run state ?

Forum for questions and support relating to the 1.25.x releases only.
Locked
hoolahoous
Posts: 10
Joined: Wed Nov 07, 2012 3:27 am

how do I find current run state ?

Post 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 ?
theforce
Posts: 129
Joined: Tue May 11, 2010 5:22 am

Re: how do I find current run state ?

Post 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.
bb99
Posts: 943
Joined: Wed Apr 02, 2008 12:04 am

Re: how do I find current run state ?

Post 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.
theforce
Posts: 129
Joined: Tue May 11, 2010 5:22 am

Re: how do I find current run state ?

Post 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.
hoolahoous
Posts: 10
Joined: Wed Nov 07, 2012 3:27 am

Re: how do I find current run state ?

Post by hoolahoous »

exactly. no way to find out what 'current' state is.
PatMcLJr
Posts: 28
Joined: Sun Sep 07, 2008 5:56 pm
Location: earth

Re: how do I find current run state ?

Post 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
----
evil doers beware, someone is watching you,
hopefully me!
hoolahoous
Posts: 10
Joined: Wed Nov 07, 2012 3:27 am

Re: how do I find current run state ?

Post 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.
Locked