Halfagain IM Forums
May 23, 2012, 23:55 *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Due to increasing spam we are forced to make this forum "Read Only". If you have an issue, most likely was discussed here. Use the Search function and try to find related discussions. If you can't find any helpful information, just email support at halfagain dot com"
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: Omar's Blueprint & Crons (error?)  (Read 1196 times)
0 Members and 2 Guests are viewing this topic.
Logical Dolphin
Newbie
*

Karma: 10
Offline Offline

Posts: 6


« on: January 18, 2007, 06:10 »

I read through this blueprint and the part on page 13 (under "Example")regarding Crons appears to be completely wrong.

As written on the blueprint:

"Set your cron to update every 25 hours. This way, it’s always at a different hour than the day before.
The cron to update every 25 hours looks like this:

10 */24 * * *
 
10 is the 10th minute of the hour, and */25 means every 25 hours. In this case, the first post may show at something like 1.10pm, the next day it will update at 2.10pm, the next day, 3.10pm, and so on. Then cycle repeats itself."

There seems to be an inconsistancy (*/24 on one line and */25 on another), and based on what my research both are invalid values for the hour crontab.

According to Wikipedia these are the valid ranges for the crontabs:

# (Use to post in the top of your crontab)
# ----------------- minute (0 - 59)
# |  -------------- hour (0 - 23)
# |  |  ----------- day of month (1 - 31)
# |  |  |  -------- month (1 - 12)
# |  |  |  |  ----- day of week (0 - 7) (Sunday=0 or 7)
# |  |  |  |  |
# *  *  *  *  *  command to be executed

The rest of the example on that blueprint example is as follows:

"However, a more tricky command is this:

*/1500 * * * *

This cron command will update your blogs every 1500 minutes, which means actually every 25 hours. But if you will use instead of 1500, some number like 1534, your blogs will update every 25 hours and 34 minutes. It’s harder to calculate how the update schedule would look, but in this case, if first post is at 1.00pm sharp, the next will be at 2.34pm (the next day), the next 3.08pm, next 4.42pm, and so on.
Pretty cool eh?"

Again, the 1500 (and 1534) values are invalid for the minute crontab, because it only accepts values (0-59).

I liked this strategy presented in the blueprint for utilizing cronjobs and tried to implement it in Cpanel, and couldn't get it to work. After doing research on the internet regarding crons, it appears as I said before, that the values presented in that example simply won't work.

I hope I am wrong about this, and if so, someone please let me know how to get the crons to work as presented in that example.

Thanks.
« Last Edit: January 18, 2007, 23:41 by Logical Dolphin » Logged
Omar
Here to help.
Administrator
Hero Member
*****

Karma: 10001
Offline Offline

Posts: 2687


« Reply #1 on: January 19, 2007, 00:13 »

Yes, unfortunately that is an error. I have to admin it was my fault actually.. When i was speaking with Scott about crontabs and stuff, and decided what to put up there.. i found some linux sites having some explanation like this

*/5   Is treated as ever 5 minutes, hours, days, or months. Replacing the 5 with another numerical value will change this option.

On some other site that i can not find anymore, it was even saying that the number can have any value.

So i told Scott that i wanna try some slick thing, and forgot to tell him it does not work.. so he just put wrote that.

Maybe it work on different versions of linux, but in couiple places i tested, if you use any number higher then maximum value allowed for that specific field, the maximum is used.

I have edited that part and only kept one way that is allowed, 10 */23 * * *
Logged
Logical Dolphin
Newbie
*

Karma: 10
Offline Offline

Posts: 6


« Reply #2 on: February 02, 2007, 17:13 »

Thanks for your reply, Omar.

I am still testing out how cron jobs work on my slhost VPS, and they still aren't working as in your example in your blueprint.

For example: I set a cron to set off every 7 hours, and I expected the following sequence: 7AM, 2PM, 9PM, 4AM, 11AM...etc

Instead I get: 7AM, 2PM, 9PM, 12AM, 7AM...etc

Based on these results the crons only work on a 24 hour schedule, where the cron schedule would reset after 12AM, and not work on an on-going schedule as depicted in the Blueprint.  I bet if I put a cron of (10 */23 * * *) it would execute only at 11:10 PM, and 12:10 AM.  I am using the current version of cPanel, for this test.

I would invite you to test this out for yourself and verify these results.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.8 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!