Scheduler

Discussion in 'Mac Programming' started by sivaprakash, Jul 4, 2011.

  1. macrumors member

    Joined:
    Mar 10, 2011
    Location:
    Chennai, India
    #1
    Hi

    Is there any open source framework for Scheduler where I should be able to run some of the tasks. I am looking something equivalent to Quartz Scheduler ( http://www.quartz-scheduler.org/ ) for Java and .Net.

    Thanks
    Siva
     
  2. macrumors 65816

    jiminaus

    Joined:
    Dec 16, 2010
    Location:
    Sydney
    #2
    To be run on Mac?
     
  3. thread starter macrumors member

    Joined:
    Mar 10, 2011
    Location:
    Chennai, India
    #3
    Yes it has to run on Mac and Objective- C based.
     
  4. macrumors 68000

    Joined:
    Jan 28, 2003
    Location:
    Less lost in L.A.
    #4
    The old cron still exists in OS X and the new tool is called Launchd. If your looking for something that handles completion dependancies, I'm not sure either would handle that.
     
  5. macrumors 65816

    jiminaus

    Joined:
    Dec 16, 2010
    Location:
    Sydney
    #5
    LOL. I recall the OP and launchd are old friends, or should I say enemies.
     
  6. thread starter macrumors member

    Joined:
    Mar 10, 2011
    Location:
    Chennai, India
    #6
    But I am looking the scheduler in different way. With that frame work I should be able to allocate some tasks and make them to run

    - Weekly once
    - Twice in a week

    like that I want to do. Is there any option available in Objective-C ?
     
  7. macrumors 6502a

    Joined:
    Apr 1, 2007
    #7
    launchd offers these options, check on Lingon for help on creating xml templates you can edit.
     
  8. thread starter macrumors member

    Joined:
    Mar 10, 2011
    Location:
    Chennai, India
  9. macrumors 65816

    jiminaus

    Joined:
    Dec 16, 2010
    Location:
    Sydney
    #9
    This is cron which xstep referred to about 5 posts above. It runs things a regular intervals. It's been been superseded by launchd on Mac OS X, but it's still there, at least up to 10.6.
     
  10. thread starter macrumors member

    Joined:
    Mar 10, 2011
    Location:
    Chennai, India
    #10
    OK., so basically I want to have all the below options in my scheduler

    Argument 1: Minute (0 - 59)
    Argument 2: Hour (0 - 23)
    Argument 3: Day of Month (1 - 31)
    Argument 4: Month (1-12)
    Argument 5: Day of Week (0 - 6) Sunday = 0
    Argument 6: Command


    I want to trigger Objective-C code from this framework. Is there any good example for me to understand ?
     
  11. macrumors 65816

    jiminaus

    Joined:
    Dec 16, 2010
    Location:
    Sydney
    #11
    Cron in not a framework. It's a daemon. There's an accompanying crontab program that can used to install user crontabs (cron tables).

    If you want to have something happen regardless of the logged in user, or even if no user is logged in but the computer is still on, then you'd add a line to /etc/crontab with arguments you copied and pasted above.

    If you want to have something happen under a particular user account (necessary if what you're launching needs to present a UI), then you create a crontab file somewhere and "install" it using the crontab program.

    The 6th argument is a command. Here you'd specify your program to execute, presumably with command line args so it does something specific.


    For more info, open Terminal and run the following commands.

    man 8 cron
    man 5 crontab
    man 1 crontab
     
  12. thread starter macrumors member

    Joined:
    Mar 10, 2011
    Location:
    Chennai, India
    #12
    Hi

    I want to have the scheduler with in my application. Cron is more like at system level. I want to add Cron items from the application. Is it possible?

    Thanks
    Siva
     
  13. macrumors 6502a

    Joined:
    Apr 1, 2007
    #13
    Do you want it to run only when your application is open?

    As to adding to cron via the Application it's possible but you should use launchd instead because Apple might deprecate cron going forwards.
     
  14. thread starter macrumors member

    Joined:
    Mar 10, 2011
    Location:
    Chennai, India
    #14
    Is there any way for me to use NSTimer and build similar setup? Only thing I need all options which are available in cron like WeekDays, 30 mns once, like that.
     
  15. macrumors 6502a

    Joined:
    Apr 1, 2007
    #15
    Yes you could, don't know if NSTimer is the best option but at least you should be able to spin of a new thread and keep the task viable as long as you application is open.
     

Share This Page