[SOLVED] 1.25 crontab issues

Forum for questions and support relating to the 1.25.x releases only.
Locked
Jeffrey
Posts: 9
Joined: Thu Jul 12, 2012 7:36 am

[SOLVED] 1.25 crontab issues

Post by Jeffrey »

Hi people,

I'm having a problem at the moment. I followed the FAQ for using crontab and using another tutorial on the internet to come up with job to start motion detection when it's 17:00 and it stops motion detection on 8:00 in the morning and also start motion detection again when it's weekend.

This is what I came up with :

0 8 * * 1-5 /usr/local/bin/zmpkg.pl MotionOff
0 17 * * 1-5 /usr/local/bin/zmpkg.pl MotionOn
* * * * 0,6 /usr/local/bin/zmpkg.pl MotionOn

I saved this but when I checked back it didn't start motion detection? I hope you guys can help us with this. I'm open for suggestions. Also we are using Ubuntu 11.10. Please note that I'm not a linux expert haha.

Thanks in advance :]
Last edited by Jeffrey on Wed Jul 25, 2012 8:58 am, edited 2 times in total.
PacoLM
Posts: 971
Joined: Wed Dec 02, 2009 9:55 pm
Location: Spain

Re: 1.25 crontab issues

Post by PacoLM »

Stupid question...Have you previously saved (in Zoneminder) the states MotionOn and MotionOff???

After more than 15 years, no longer using ZM as surveillance system.
Now in the dark side, using a commercial system...
Jeffrey
Posts: 9
Joined: Thu Jul 12, 2012 7:36 am

Re: 1.25 crontab issues

Post by Jeffrey »

Of course I did save the states :]
mythedoff
Posts: 25
Joined: Sat Dec 04, 2010 5:21 pm

Re: 1.25 crontab issues

Post by mythedoff »

Did you?

Code: Select all

sudo crontab -e
Jeffrey
Posts: 9
Joined: Thu Jul 12, 2012 7:36 am

Re: 1.25 crontab issues

Post by Jeffrey »

mythedoff wrote:Did you?

Code: Select all

sudo crontab -e
Yes, I did. I checked again at the customer just a moment ago and saw that the test that I put in worked just fine. The motion goes off at 8:00 and turn back on at 17:00 so the problem is in the lines.

I used this in the weekend to check the result out.

Code: Select all

0 8 * * * /usr/local/bin/zmpkg.pl MotionOff
0 17 * * * /usr/local/bin/zmpkg.pl MotionOn
And this works perfectly but it is not what I want. I want it to turn off the motion detection at 8:00 to 17:00 and then turn it back on. But also turn on motion detection when it's a weekend.

Thanks in advance :]
Jeffrey
Posts: 9
Joined: Thu Jul 12, 2012 7:36 am

Re: [UNSOLVED] 1.25 crontab issues

Post by Jeffrey »

I'm still in a need of help? Can't somebody help me with this?
mythedoff
Posts: 25
Joined: Sat Dec 04, 2010 5:21 pm

Re: [UNSOLVED] 1.25 crontab issues

Post by mythedoff »

Maybe some additions to each line.

Like:

Code: Select all

0 8 * * 1-5 /usr/local/bin/zmpkg.pl MotionOff > /somedirectory/stdout.log 2>/somedirectory/stderr.log
Christo
Posts: 89
Joined: Wed Feb 01, 2012 9:48 pm

Re: 1.25 crontab issues

Post by Christo »

Jeffrey wrote:
mythedoff wrote:Did you?

Code: Select all

sudo crontab -e
Yes, I did. I checked again at the customer just a moment ago and saw that the test that I put in worked just fine. The motion goes off at 8:00 and turn back on at 17:00 so the problem is in the lines.

I used this in the weekend to check the result out.

Code: Select all

0 8 * * * /usr/local/bin/zmpkg.pl MotionOff
0 17 * * * /usr/local/bin/zmpkg.pl MotionOn
And this works perfectly but it is not what I want. I want it to turn off the motion detection at 8:00 to 17:00 and then turn it back on. But also turn on motion detection when it's a weekend.

Thanks in advance :]
Hello,

Your requested timetable to run these states can be done to add a crontab for each timeframe.

If you don't understand the way crontabs are used, try to do this with the help of the Webmin calender interface.

Goed luck and regards, Christo
Jeffrey
Posts: 9
Joined: Thu Jul 12, 2012 7:36 am

Re: 1.25 crontab issues

Post by Jeffrey »

Your requested timetable to run these states can be done to add a crontab for each timeframe.
You might wanna explain this more for me. Do you mean that adding it for every hour etc ?
Christo
Posts: 89
Joined: Wed Feb 01, 2012 9:48 pm

Re: 1.25 crontab issues

Post by Christo »

Jeffrey wrote:
Your requested timetable to run these states can be done to add a crontab for each timeframe.
You might wanna explain this more for me. Do you mean that adding it for every hour etc ?
Hello,

No, not for every hour!!

Example:
If you like to have a different runstate for weekdays and weekends, you should make separate crontabs.

As suggested.. install webmin and you will get my point!!
Webmin offers a visual timetable, and I am sure that youll get my point.

If you don't succeed, you can drop me a line with the exact timescedule(s) that you want!

Good luck!!
Jeffrey
Posts: 9
Joined: Thu Jul 12, 2012 7:36 am

Re: [SOLVED] 1.25 crontab issues

Post by Jeffrey »

I'm testing a new configuration as we speak. I tested the crontab that I posted in the beginning and it seems to work.

Notes of what I did to make it work for future reference.

1 : Check if the time and/or timezone is correctly configured on the computer. (This was probably the problem)

2 : I tested the motion detection code in the terminal before applying to the crontab.

3 : I tested the wiki crontab configuration. (Just to test that it did work)

4 : I edited it back to my crontab configuration in the opening post to config it as I needed it to be.

3 : Double checked in the crontab for uppercase input and if so change it. (This can vary per computer) (This was probably the problem)

There was no need to install webmin after all and my first configuration was in the end just working fine.

Thanks for your attempts to help me guys,

Jeffrey
mythedoff
Posts: 25
Joined: Sat Dec 04, 2010 5:21 pm

Re: [SOLVED] 1.25 crontab issues

Post by mythedoff »

Glad you figured it out. Had me thinking.
FWIW, the third line of your crontab will run every minute.
Locked