Find the answer to your Linux question:
Results 1 to 6 of 6
I have a job that I want to run every other wednesday at 645 so would I code the entry as 45 18 3/2 there are 2 blanks between 18 ...
  1. #1
    Linux Newbie
    Join Date
    Jun 2006
    Posts
    139

    quick cron question

    I have a job that I want to run every other wednesday at 645
    so would I code the entry as
    45 18 3/2 there are 2 blanks between 18 and 3??
    thanks
    Mace

  2. #2
    Linux Newbie harner's Avatar
    Join Date
    Jun 2004
    Location
    PA, USA
    Posts
    209
    Im sure someone here could help, but I typically set a my crons and scheduled commands via Webmin. It makes my life much easier.
    I praise Webmin and PuTTy!
    Registered Linux User: 439431

  3. #3
    Linux Guru
    Join Date
    Oct 2007
    Location
    Tucson AZ
    Posts
    1,946
    The cron command doesn't really have any way to express odd/even weeks but this site has a solution that doesn't look to complicated. In your entry, you left two blank entry spaces for day of month and month and you will need to have an entry for the month (*) if you want every other Wed. every month. This site should help you:

    http://sysunconfig.net/aixtips/cron_trick.txt

    Let us know if this works.

  4. #4
    Linux Newbie
    Join Date
    Jun 2006
    Posts
    139
    Well I set it yesterday like this:
    45 18 30 4 3/2
    and the command ran last night at 1845.
    So I'm hoping that it will skip next wednesday and run the wednesday after.
    The only problem I'll have is in 5 week months. I will have to adjust the command.
    But if anyone knows any secrets I'd love to hear them
    thanks
    Mace

  5. #5
    Linux Guru
    Join Date
    Oct 2007
    Location
    Tucson AZ
    Posts
    1,946
    You will need to replace your fourth entry (4) with (*) to get it to run every month. You could also do (1-12) in that space. I think if you replace your third entry (30) with an asterisk, it will run every Wednesday. Not sure what to do here but maybe putting a zero (0) would work. Maybe it would just confuse the program as it is probably looking for numbers from 1-31. Did you check the site in my last post?

  6. #6
    Linux Newbie
    Join Date
    Jun 2006
    Posts
    139
    yancek thanks for the reply. I put in the exact date so I would be sure the task ran. I did forget about the * in the month field afterwadrs so thank you for the reminder.
    I did look at the site you gave and I think I'll run into the same problem as I have with cron, that is in 5 week months the logic will get mixed up.
    My problem is the task must run on certain wednesdays and I'm going to have to figure out if the /2 will work. If not then I'll have to put more logic into the task to figure out when and when not to run.
    thanks
    Mace

Posting Permissions

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