This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

varibles help

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
G
Gemster
Halfop
Posts: 51
Joined: Mon Oct 04, 2010 5:43 pm

Post by Gemster »

I had a look at them site you posted but i still get confused as they do say "* */1 * * *" every 1 hour

or
"* *1-24 * * *"

and for every 2 hours it be like this:

"* *0,2,4,6,8,10,12,14,16,18,20,22 * * *"

is this correct. Its very confusing but i guess once u get the hang of it, it gets easyer to understand.

Thanks
Gemster
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

It can contain up to five fields: minute, hour, day, month, weekday; delimited by whitespace.
So the "* */1 * * *" should trigger once every hour, 24/7/365 (or 366). A 'every two hours' crontab mask will be: "* */2 * * *"
Once the game is over, the king and the pawn go back in the same box.
w
willyw
Revered One
Posts: 1203
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

Gemster wrote: ...
Its very confusing but i guess once u get the hang of it, it gets easyer to understand.
I won't argue with that. :)

Try:
"0 * * * *"

Won't that make it run every hour, on the minute that ends in :00 ?
If you want to choose a different minute of the hour, just change that number.

Disclaimer:
I'm not saying that this is THE right way to do it. Perhaps someone else will be along...

In the meantime, try it, and let us know.
G
Gemster
Halfop
Posts: 51
Joined: Mon Oct 04, 2010 5:43 pm

Post by Gemster »

caesar wrote:
It can contain up to five fields: minute, hour, day, month, weekday; delimited by whitespace.
So the "* */1 * * *" should trigger once every hour, 24/7/365 (or 366). A 'every two hours' crontab mask will be: "* */2 * * *"
It dosent tho. Even if i do "* */2 * * *" or "* */3 * * *" it still triggers every minute as tho its ignoring the /1, /2 or /3.

Yes willyw it works with "0 * * * *" but what if i need it for every 2 hours or every 3 hours ?

Thanks
Gemster
w
willyw
Revered One
Posts: 1203
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

Gemster wrote: ...
Yes willyw it works with "0 * * * *" but what if i need it for every 2 hours or every 3 hours ?
Here:
http://www.linuxhelp.net/guides/cron/
it says
If you wanted to run a command every 2 hours you could enter in */2 for the hour field. This would run the specified command at 2am, 4am, 6am, 8am, 10am, 12pm, 2pm, and so on. An example of this type of entry would be:

0 */2 * * *
And if that doesn't work, I wonder...
what if you entered a list of specific hours?
"0 0,2,4,6,8,10,12,14,16,18,20,22 * * *"
G
Gemster
Halfop
Posts: 51
Joined: Mon Oct 04, 2010 5:43 pm

Post by Gemster »

Ok willyw,

Testing 0 */2 * * * now to see if that works, if not ill test the "0 0,2,4,6,8,10,12,14,16,18,20,22 * * *".

I guess thats a 4 hour test lol.

Ill let u know if any of them work in 4 hours :D

Thanks
Gemster
G
Gemster
Halfop
Posts: 51
Joined: Mon Oct 04, 2010 5:43 pm

Post by Gemster »

Ok "0 */2 * * *" seems to be working so far :D

I think what the problem is , is that the first * meens every minute so that would explain why "* */2 * * *" done the command every minute instead of every 2 hours.

Thanks
Gemster

Edit: Yes its working every 2 hours with "0 */2 * * *" :D
Post Reply