[launchd-dev] Problem with launchd starting user defined launchagent service in root user login

Nandini Vijayashankar vnandini at novell.com
Wed Dec 21 21:00:31 PST 2011

I want to know how does launchd start the user defined launchagents service when a "root" user logs in to the system.
Iam using Mac 10.6
I have a launchdaemon and launchagent present in /System/Library/LaunchDaemons and /System/Library/LaunchAgents.
When I login with a non-root user, my launchagent service is started as that logged in user.
I can unload this service using "launchctl unload /System/Library/LaunchAgents/<plistfile>"
If I login as root user,my launchagent  service is started and working fine.But its not started as logged in user ie., root.
If I try to unload through "launchctl unload /System/Library/LaunchAgents/<plistfile>" I get error: 
launchctl : Error unloading <id>
This is because the service is not launched as root user.
Above scenarios are working fine in Mac 10.5 as root and non-root user.
When i see my launchagent service in Activity monitor, the parent process is the per-user launchd instance.
The parent process of this launchd is system launchd with pid 1.
I have tried to list the service using various commands:
launchctl list
launchctl bslist
sudo launchctl list
All these are not showing my launchagent service.Is there any special way, launchd launches launchagents service when a root user logs in Mac 10.6?
How can i unload my launchagent service when the root user logs in?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/launchd-dev/attachments/20111221/20cc71bc/attachment.html>

More information about the launchd-dev mailing list