Find the answer to your Linux question:
Results 1 to 9 of 9
I need to schedule a script through crontab file so that it runs every 14 days. Can anyone tell me what should be the crontab entry for this?...
  1. #1
    Just Joined!
    Join Date
    May 2009
    Posts
    8

    Thumbs up Crontab entry to schedule a script every 14 days

    I need to schedule a script through crontab file so that it runs every 14 days.
    Can anyone tell me what should be the crontab entry for this?

  2. #2
    Linux User kmitnick's Avatar
    Join Date
    May 2008
    Location
    Jordan - Amman
    Posts
    329
    what is crontab???
    Dual Booting Ubuntu 10.04, Windows 7

    Toshiba Satellite A200-1M5, Duo Core 2.0 Ghz, 1 Gigs RAM, 256 Intel Card

    You are registered Linux user number 490788
    Happy Linuxing

  3. #3
    Just Joined!
    Join Date
    Jan 2009
    Location
    colachel
    Posts
    27
    # m h dom mon dow command
    * * */14 * * your script file

  4. #4
    Linux User peteh's Avatar
    Join Date
    Oct 2006
    Location
    UK
    Posts
    337
    Quote Originally Posted by sahabcse View Post
    # m h dom mon dow command
    * * */14 * * your script file
    I'm not sure that works. It would be every 14 days within the month, I think. That's 14th and 28th each time.
    Please let me know if I'm wrong.
    Pete

  5. #5
    Just Joined!
    Join Date
    May 2009
    Posts
    8
    I have tried with this command. It runs the script on 14th and 28th of every month,not after every 14 days

  6. #6
    Linux User kmitnick's Avatar
    Join Date
    May 2008
    Location
    Jordan - Amman
    Posts
    329
    i see it the same there is sometimes a 1 day delay and some times it i s2 days,
    Dual Booting Ubuntu 10.04, Windows 7

    Toshiba Satellite A200-1M5, Duo Core 2.0 Ghz, 1 Gigs RAM, 256 Intel Card

    You are registered Linux user number 490788
    Happy Linuxing

  7. #7
    Just Joined!
    Join Date
    May 2009
    Posts
    8
    According to the requirement the schedule date should not be date specific i.e. on14th and 28th for example. It should run after every 14 days. I have tried with the above command. But it won't work as per requirement

  8. #8
    Linux User kmitnick's Avatar
    Join Date
    May 2008
    Location
    Jordan - Amman
    Posts
    329
    I am currently learning shell scripting right now using book from Bible, it is awesome by the way, anyway, what I am going to say is that if you can make a script every day and inside make the 14 days check, so you have to save the last date in a file and every day it is checked if the current date minus the date in the file =14 then run the other script ( your desired script) and save the current date in the file and so on.

    NOTE:I am new to shell scripting so I don't know how is this can be done...
    Dual Booting Ubuntu 10.04, Windows 7

    Toshiba Satellite A200-1M5, Duo Core 2.0 Ghz, 1 Gigs RAM, 256 Intel Card

    You are registered Linux user number 490788
    Happy Linuxing

  9. #9
    Linux Enthusiast Bemk's Avatar
    Join Date
    Sep 2008
    Location
    Oosterhout-NB, Netherlands
    Posts
    522
    I wonder if it's even possible. I've done some Google searches and every time I see people telling others it's impossible. I think you should handle it in your own code and let cron call it every week (lets say day 1 of week, that's possible). I don't really know anything else.

Posting Permissions

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