[launchd-dev] unloading user jobs as root

Tamás Lustyik - NTRglobal tlustyik at ntrglobal.com
Fri Feb 12 06:15:12 PST 2010


Hi,

I'm having trouble with unloading jobs launched from /Library/LaunchAgents and since I haven't had success in googling around I decided to ask for help here.

I have an agent application which should run in the LoginWindow and Aqua contexts. A proper plist file has been created and works fine, the job loads and unloads automagically when the different sessions are entered/left. Now, the problem is with uninstallation. I have a separate uninstaller application which, at some point, is elevated to have root privileges to perform removal of files etc. Unfortunately, when running as root, launchctl does not seem to access the session of the logged in users, thus making it impossible to unload these already active jobs. I suppose calling launchctl as a regular user wouldn't work either for user sessions other than the current one.

Can anyone give me pointers how to solve this? I do have read the Daemonomicon and also the list archives of last year but I might have missed the answer.

Thanks,
Tamas Lustyik


More information about the launchd-dev mailing list