Find the answer to your Linux question:
Results 1 to 3 of 3
Hi, I'm looking to do a recursive cron job, what I mean is: I need a job to be executed every 4 days. I don't know how to start this, ...
  1. #1
    Just Joined!
    Join Date
    May 2005
    Posts
    8

    Recursive cron job?

    Hi,

    I'm looking to do a recursive cron job, what I mean is: I need a job to be executed every 4 days.

    I don't know how to start this, because what I have read in the man crontab and in the net is that you set a job for a determined hour, minute, second or even day of the week, but you can set it for every xx amout of minutes, hours, days.

    Any help on this?

    Thanks!

  2. #2
    Linux Engineer
    Join Date
    Nov 2004
    Location
    Ft. Polk, LA
    Posts
    796
    From the crontab man page:
    Step values can be used in conjunction with ranges. Following a range with ``/<number>'' specifies skips of the number's value through the
    range. For example, ``0-23/2'' can be used in the hours field to specify
    command execution every other hour (the alternative in the V7 standard is
    ``0,2,4,6,8,10,12,14,16,18,20,22''). Steps are also permitted after an
    asterisk, so if you want to say ``every two hours'', just use ``*/2''.
    Sounds like you can put */4 in the day of month field and it will run it every 4 days.

  3. #3
    Just Joined!
    Join Date
    May 2005
    Posts
    8
    Thanks Valan, well, that&#180;s exacttly what I did, I settet it up like this:

    15 3 * * */4 <script to run>

    So, it should run at 03:15 (AM) every 4 days.

    Let&#180;s see in 4 days if it works.
    Last edited by heldmar; 10-27-2007 at 11:52 AM. Reason: I made a mistake

Posting Permissions

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