Re: Running daemon services.
Re: Running daemon services.
- Subject: Re: Running daemon services.
- From: "Finlay Dobbie" <email@hidden>
- Date: Wed, 14 Feb 2007 10:17:06 +0000
You should not invoke sudo like this. You should use Authorization
Services to invoke a tool that you control, which should probably talk
to launchd cia the API defined in launch.h
Really, this has very little to do with Cocoa. Cocoa is an application
framework, it is not designed to have a wrapper for every other little
API in the system.
If you have further questions about auth services, you should probably
ask on apple-cdsa; if you have further questions about launchd you
should probably ask on darwin-dev.
-- Finlay
On 14/02/07, sharad saxena <email@hidden> wrote:
Hi Finlay,
I am currently using launchctl functions only to get the list of
running services and to start stop the services, here's part of my
code -
NSString * arg1 = [NSString stringWithString:@"-c"];
NSString * arg2 = [NSString stringWithFormat:@"sudo launchctl list >
\"%@\"", service];
NSArray * args = [NSArray arrayWithObjects:arg1, arg2, nil];
/* [(withPrivileges) executeCommand:@"/bin/sh" withArguments:args]; */
The problem with the above code is when I use sudo to get the list of
running services then it *sometimes* hang and log shows its waiting
for password:
So I was looking around for some fool proof cocoa API (if exists).
Unfortunately there is none I guess.
Thanks,
Sharad!
On 2/13/07, email@hidden <email@hidden> wrote:
> Well, not all daemons are necessarily loaded into launchd. Anyway, I
> suggest looking at the source to launchctl (available via Darwin) to
> see how it does it.
>
> -- Finlay
>
> Quoting sharad saxena <email@hidden>:
>
> > Actually I want to get the list of all the jobs (services) loaded into
> > launchd.
> >
> > On 2/12/07, Finlay Dobbie <email@hidden> wrote:
> >>
> >> On 12/02/07, sharad saxena <email@hidden> wrote:
> >>> Hi ,
> >>> Is there any cocoa API through which I can get the list of running
> >> services?
> >>
> >> If you mean get a list of processe, then see
> >> <http://developer.apple.com/qa/qa2001/qa1123.html>.
> >>
> >> -- Finlay
> >>
>
>
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden