If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > Crontab configuration

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-23-10, 11:31
loopoo loopoo is offline
Registered User
 
Join Date: Aug 2005
Posts: 23
Crontab configuration

Hi,

Is there a way to configure a process to be lanched in the "n"th working day?
Let's say n=5. In this case, if the 5th of the month is on Saturday, then the 5th working day will be on Monday so I would like to launch the process on the 7th.
The same when the 5th of the month is on Monday, it means that it's only the 3rd working day, so I would need to launch the process on Wednesday - the 7th of the month.

Thanks in advance,
Chris
Reply With Quote
  #2 (permalink)  
Old 09-23-10, 14:57
LKBrwn_DBA LKBrwn_DBA is offline
Registered User
 
Join Date: Jun 2003
Location: West Palm Beach, FL
Posts: 2,414
Cool Script-it...

You could code a simple ksh (or perl) script to obtain the result you need.
Then just schedule like this:
Code:
# Crontab...
00 08 * * 1-5 [ `chk_business_day.sh` -eq 5 ] && <the job to execute>
__________________
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

Last edited by LKBrwn_DBA; 09-23-10 at 16:17.
Reply With Quote
  #3 (permalink)  
Old 09-24-10, 10:09
loopoo loopoo is offline
Registered User
 
Join Date: Aug 2005
Posts: 23
Thank you, your post was very helpful.
Reply With Quote
  #4 (permalink)  
Old 09-24-10, 13:07
LKBrwn_DBA LKBrwn_DBA is offline
Registered User
 
Join Date: Jun 2003
Location: West Palm Beach, FL
Posts: 2,414
Cool Business days...

Quote:
Originally Posted by loopoo View Post
Thank you, your post was very helpful.
Attached is a script if you need one...
Attached Files
File Type: txt chk_business_day.sh.txt (999 Bytes, 93 views)
__________________
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

Last edited by LKBrwn_DBA; 09-24-10 at 13:29.
Reply With Quote
  #5 (permalink)  
Old 09-24-10, 13:31
kitaman kitaman is offline
Registered User
 
Join Date: Sep 2009
Location: Ontario
Posts: 528
The 5th working day could be any date from the fifth through the ninth, and maybe longer if there were a two week plant shutdown for instance.
Use the holiday file concept, but only include the dates that the job should run on, and run the cron job every day.
Create a directory workday, and include files in it named 20100924 etc. Maybe include as data in the file, the job steps to be run that day.
Then:
Code:
00 08 * * * [ -r /workday/`date +"%Y%m%d"` ] && job

Last edited by kitaman; 09-24-10 at 13:33. Reason: typo
Reply With Quote
  #6 (permalink)  
Old 09-30-10, 13:21
sles sles is offline
Registered User
 
Join Date: Sep 2010
Posts: 3
Thank you, Tips for me
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On