Re: Crontab/Scheduled tasks
Re: Crontab/Scheduled tasks
- Subject: Re: Crontab/Scheduled tasks
- From: Martin Weil <email@hidden>
- Date: Fri, 27 Dec 2002 21:04:47 +0100
Am Donnerstag, 26.12.02 um 20:45 Uhr schrieb David Remahl:
Third question is, if there is any possibility to know whether my was
started by crontab or by the user?
I suppose you could look at the time and make a probabilistic guess.
In your crontab, make sure you pass an argument to your application
when starting it.
30 5 1 * * chmod007
/Applications/YourApp.app/Contents/MacOS/YourApp -startFromCron
Then in your application programming, you check the list of arguments
passed to your application (- [NSProcessInfo arguments]) and see if
the argument from the crontab was passed to the application.
I thought about time guessing myself before, and I think its really not
so clean programming. Think about what happens when the processor is
quite busy. Will the app be started in time?
Using NSProcessInfo seems like a much cleaner option.
Thank you.
Best Regards
Martin
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.