Re: Launch process as root from cocoa app

2010-01-27 Thread Nyxem
It didn't work, I'm gonna try the solution given by Kyle Sluder, with the KeepAlive options of launchd.plist. On Jan 27, 2010, at 4:34 AM, Charles Srstka wrote: > On Jan 25, 2010, at 9:18 PM, Nick Zitzmann wrote: > >> >> On Jan 25, 2010, at 12:57 AM, Nyxem wrote: >> >>> 1 - Using the authoriz

Re: Launch process as root from cocoa app

2010-01-26 Thread Charles Srstka
On Jan 25, 2010, at 9:18 PM, Nick Zitzmann wrote: > > On Jan 25, 2010, at 12:57 AM, Nyxem wrote: > >> 1 - Using the authorizationRef object of my SFAuthorizationView and call >> AuthorizationExecuteWithPrivileges() ("/bin/launchctl load >> /Library/LaunchDaemons/com.mydaemon.plist") >> --

Re: Launch process as root from cocoa app

2010-01-25 Thread Kyle Sluder
On Mon, Jan 25, 2010 at 7:23 PM, Jens Alfke wrote: > The OP wants to allow a button in the UI to start and stop the job. That's > not something you can configure a plist for! You configure the launchd job's plist to watch for a path and create/remove that file in response to the UI action. This

Re: Launch process as root from cocoa app

2010-01-25 Thread Jens Alfke
On Jan 25, 2010, at 6:53 PM, Kyle Sluder wrote: > Do not do use launchctl for this. Launchd has plenty of ways of > determining when to start and stop jobs. You should configure your > job's plist accordingly. The OP wants to allow a button in the UI to start and stop the job. That's not someth

Re: Launch process as root from cocoa app

2010-01-25 Thread Nick Zitzmann
On Jan 25, 2010, at 12:57 AM, Nyxem wrote: > 1 - Using the authorizationRef object of my SFAuthorizationView and call > AuthorizationExecuteWithPrivileges() ("/bin/launchctl load > /Library/LaunchDaemons/com.mydaemon.plist") > --> Failed. daemon not launched as root, but as current user.

Re: Launch process as root from cocoa app

2010-01-25 Thread Kyle Sluder
On Sun, Jan 24, 2010 at 11:57 PM, Nyxem wrote: > I'm currently working on a Preference Pane with an SFAuthorizationView, my > problem is simple, when I click on a switch button I need to start / stop a > daemon as user using launchctl. Do not do use launchctl for this. Launchd has plenty of way

Launch process as root from cocoa app

2010-01-25 Thread Nyxem
Hello, I'm currently working on a Preference Pane with an SFAuthorizationView, my problem is simple, when I click on a switch button I need to start / stop a daemon as user using launchctl. I tried 3 different ways and the only one that is working is the slowest, here the 3 ways I tried : 1 -