hi all,
just to simplify what posted yesterday,
I'd like to set a cron job every minute but only from 2pm to 4pm of a specific day, clearly without having to set 120 different jobs.
as secondary goal I'd like to be able to modify with ease the interval (for instance fro 11am to 3pm)
is it possible?
thanks!
Ale
how to create cron jobs for part of the day
Moderator: General Moderators
- Jonah Bron
- DevNet Master
- Posts: 2764
- Joined: Thu Mar 15, 2007 6:28 pm
- Location: Redding, California
Re: how to create cron jobs for part of the day
Probably. I've never actually set up a CRON job myself, so I don't know how to do that particular thing. If you haven't already, you should read some tutorials on the subject.
http://www.google.com/search?q=cron+tutorial
http://www.google.com/search?q=cron+tutorial
Re: how to create cron jobs for part of the day
We have a client that I set up a cron that runs hourly to get a report of the orders during that hour and sync them to their server and e-mail a report to let them know if orders needed processed.
To make it simple, I have it run every hour of every day, and then at the top of the script make sure the hour is from 8am to 5pm and monday-friday, if not, it immediately exits. This was going to expand to allow the client through their admin set up times not to send it. (they in the end decided they didn't need this, they are fine with the extra e-mails piled up after a holiday).
-Greg
To make it simple, I have it run every hour of every day, and then at the top of the script make sure the hour is from 8am to 5pm and monday-friday, if not, it immediately exits. This was going to expand to allow the client through their admin set up times not to send it. (they in the end decided they didn't need this, they are fine with the extra e-mails piled up after a holiday).
-Greg
Re: how to create cron jobs for part of the day
twinedev wrote:We have a client that I set up a cron that runs hourly to get a report of the orders during that hour and sync them to their server and e-mail a report to let them know if orders needed processed.
To make it simple, I have it run every hour of every day, and then at the top of the script make sure the hour is from 8am to 5pm and monday-friday, if not, it immediately exits. This was going to expand to allow the client through their admin set up times not to send it. (they in the end decided they didn't need this, they are fine with the extra e-mails piled up after a holiday).
-Greg
Good idea, I need a better "sampling resolution" but if I set it to check every quarter of hour, I think it'll be a good arrangement.
Sure it'd be better if I can trim directly the cron... but I think I can start the service in this way.
Thank you!
Re: how to create cron jobs for part of the day
Jonah Bron wrote:Probably. I've never actually set up a CRON job myself, so I don't know how to do that particular thing. If you haven't already, you should read some tutorials on the subject.
http://www.google.com/search?q=cron+tutorial
Hi Jonah,
I already use cron commands, even though I'm not an expert. But since now I never found a manual or a solution that can create what I'm searching for. But Hope dies last
thank you!
Re: how to create cron jobs for part of the day
Is not this what you are looking for? (Mon is just an example)Aleale wrote:hi all,
just to simplify what posted yesterday,
I'd like to set a cron job every minute but only from 2pm to 4pm of a specific day, clearly without having to set 120 different jobs.
as secondary goal I'd like to be able to modify with ease the interval (for instance fro 11am to 3pm)
is it possible?
thanks!
Ale
[text]# Minute Hour Day of Month Month Day of Week Command
# (0-59) (0-23) (1-31) (1-12 or Jan-Dec) (0-6 or Sun-Sat)
* 14-16 * * Mon <your command>[/text]
this line will execute <your command> every minute, between 2PM and 4PM on Mondays for every Month for every day of the month (no tested on my side)