PDA

View Full Version : Scheduler




sivaprakash
Jul 5, 2011, 12:36 AM
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 (http://www.quartz-scheduler.org/)/ ) for Java and .Net.

Thanks
Siva



jiminaus
Jul 5, 2011, 12:50 AM
for Java and .Net.

To be run on Mac?

sivaprakash
Jul 5, 2011, 01:48 AM
Yes it has to run on Mac and Objective- C based.

xStep
Jul 5, 2011, 04:13 AM
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.

jiminaus
Jul 5, 2011, 06:51 AM
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.

LOL. I recall the OP and launchd are old friends, or should I say enemies.

sivaprakash
Jul 6, 2011, 02:23 AM
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 ?

Hansr
Jul 6, 2011, 03:41 AM
launchd offers these options, check on Lingon for help on creating xml templates you can edit.

sivaprakash
Jul 6, 2011, 07:07 AM
Will this help me

http://benr75.com/pages/using_crontab_mac_os_x_unix_linux

jiminaus
Jul 6, 2011, 07:29 AM
Will this help me

http://benr75.com/pages/using_crontab_mac_os_x_unix_linux

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.

sivaprakash
Jul 6, 2011, 07:42 AM
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 ?

jiminaus
Jul 6, 2011, 07:50 AM
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 ?

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

sivaprakash
Jul 7, 2011, 04:36 AM
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

Hansr
Jul 7, 2011, 05:25 AM
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

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.

sivaprakash
Jul 7, 2011, 06:01 AM
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.

Hansr
Jul 7, 2011, 06:09 AM
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.