Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2005
    Posts
    23

    Unanswered: 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

  2. #2
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    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>
    Last edited by LKBrwn_DBA; 09-23-10 at 16:17.
    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

  3. #3
    Join Date
    Aug 2005
    Posts
    23
    Thank you, your post was very helpful.

  4. #4
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    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 Attached Files
    Last edited by LKBrwn_DBA; 09-24-10 at 13:29.
    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

  5. #5
    Join Date
    Sep 2009
    Location
    Ontario
    Posts
    1,057
    Provided Answers: 1
    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

  6. #6
    Join Date
    Sep 2010
    Posts
    3
    Thank you, Tips for me

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •