[SOLVED] 1.25 crontab issues
[SOLVED] 1.25 crontab issues
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 :]
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.
Re: 1.25 crontab issues
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...
Re: 1.25 crontab issues
Of course I did save the states :]
Re: 1.25 crontab issues
Did you?
Code: Select all
sudo crontab -e
Re: 1.25 crontab issues
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.mythedoff wrote:Did you?Code: Select all
sudo crontab -e
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
Thanks in advance :]
Re: [UNSOLVED] 1.25 crontab issues
I'm still in a need of help? Can't somebody help me with this?
Re: [UNSOLVED] 1.25 crontab issues
Maybe some additions to each line.
Like:
Like:
Code: Select all
0 8 * * 1-5 /usr/local/bin/zmpkg.pl MotionOff > /somedirectory/stdout.log 2>/somedirectory/stderr.log
Re: 1.25 crontab issues
Hello,Jeffrey wrote: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.mythedoff wrote:Did you?Code: Select all
sudo crontab -e
I used this in the weekend to check the result out.
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.Code: Select all
0 8 * * * /usr/local/bin/zmpkg.pl MotionOff 0 17 * * * /usr/local/bin/zmpkg.pl MotionOn
Thanks in advance :]
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
Re: 1.25 crontab issues
You might wanna explain this more for me. Do you mean that adding it for every hour etc ?Your requested timetable to run these states can be done to add a crontab for each timeframe.
Re: 1.25 crontab issues
Hello,Jeffrey wrote:You might wanna explain this more for me. Do you mean that adding it for every hour etc ?Your requested timetable to run these states can be done to add a crontab for each timeframe.
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!!
Re: [SOLVED] 1.25 crontab issues
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
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
Re: [SOLVED] 1.25 crontab issues
Glad you figured it out. Had me thinking.
FWIW, the third line of your crontab will run every minute.
FWIW, the third line of your crontab will run every minute.