Re: Running daemon services.
Re: Running daemon services.
- Subject: Re: Running daemon services.
- From: Brian Smith <email@hidden>
- Date: Wed, 14 Feb 2007 13:07:32 +0800
On Feb 14, 2007, at 12:37 PM, sharad saxena wrote:
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:
To run launchctl you should use the Authentication API instead of
trying to use sudo. Look in the document for this which has links to
sample code.
Brian
_______________________________________________
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