Hi,

You should try:
launchctl -u root unload /System/Library/LaunchAgents/<plistfile>

Thomas

On Dec 22, 2011, at 6:00 AM, Nandini Vijayashankar wrote:

Hi,
 
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?
 
 
 
 
_______________________________________________
launchd-dev mailing list
launchd-dev@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/launchd-dev