FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > CentOS > CentOS

 
 
LinkBack Thread Tools
 
Old 06-18-2008, 05:11 PM
Jeff
 
Default Single crontab entry for every 15 minutes beginning & ending on the hour

We have a cron job that needs to run every 15 minutes throughout
business hours. The first run is at 8:00, the last run is at 17:00. Is
it possible to specify this time range in a single line?

*/15 8-17 * * 1-5 will run 8:00 - 17:45. That's not what I want.

Likewise

*/15 8-16 * * 1-5 will have the last run at 16:45, not 17:00

This is more of a brainteaser than a real problem. I can easily
configure the job with multiple entries, but I'm a little
obsessive-compulsive so I want to try to do it with one entry.

# rpm -qa vixie-cron
vixie-cron-4.1-49.EL4

--
Jeff
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 06-18-2008, 10:05 PM
 
Default Single crontab entry for every 15 minutes beginning & ending on the hour

In article <d1f9b6f00806181011w2f5bde1fqffe824cbc565a802@mail .gmail.com>,
Jeff <jlar310@gmail.com> wrote:
> We have a cron job that needs to run every 15 minutes throughout
> business hours. The first run is at 8:00, the last run is at 17:00. Is
> it possible to specify this time range in a single line?
>
> */15 8-17 * * 1-5 will run 8:00 - 17:45. That's not what I want.
>
> Likewise
>
> */15 8-16 * * 1-5 will have the last run at 16:45, not 17:00
>
> This is more of a brainteaser than a real problem. I can easily
> configure the job with multiple entries, but I'm a little
> obsessive-compulsive so I want to try to do it with one entry.

I'm pretty sure it's not possible to do in one line just in cron.
You can do it with a bit of shell too:

*/15 8-17 * * 1-5 [ `date +\%H\%M` -lt 1715 ] && /do/my/job.sh

Cheers
Tony
--
Tony Mountifield
Work: tony@softins.co.uk - http://www.softins.co.uk
Play: tony@mountifield.org - http://tony.mountifield.org
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 

Thread Tools




All times are GMT. The time now is 05:55 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org