Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2003

    Unanswered: cron job scheduling

    I want to kick off a db2 reorg every 4th Sunday at 3:00 a.m. What would the crontab command look like??

  2. #2
    Join Date
    Sep 2004
    Put the following line in your cron file:
    0 3 22-28 * sun db2 reorg ....
    (since the 4th sunday of a month is always between the 22nd and the 28th).
    Or better, put the "db2 reorg" command in a script and give the script name as the command.

    Beware that some crond implementations will OR the day-of-month and day-of-week fields, i.e., the above will run on every sunday AND on every 22nd etc of the month.

    In this case it's safer to move some of the logic into the script:
    have a cron entry of the form
    0 3 22-28 * * exec $HOME/
    and start the script with:
    test `date +%u` = 7 || exit 0
    or somewhat safer:
    test `date +%a` = 'Sun' || exit 0

    If you crond does not understand the range 22-28 notation, replace it by 22,23,24,25,26,27,28
    Last edited by Peter.Vanroose; 08-25-06 at 14:47.
    --_Peter Vanroose,
    __IBM Certified Database Administrator, DB2 9 for z/OS
    __IBM Certified Application Developer
    __ABIS Training and Consulting

  3. #3
    Join Date
    Sep 2003
    Thanks Peter...I'll try it.

Posting Permissions

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