[launchd-dev] Environment Variables and LimitLoadToSessionType?

Dave Zarzycki zarzycki at apple.com
Mon Oct 15 12:42:46 PDT 2007


On Oct 15, 2007, at 11:59 AM, Matthew Hansen wrote:

> Question about environment variables under launchd (10.4)...
>
> Our launchd item needs to run as root and theres really no way  
> around that, we are small, low level admin maintenance on many  
> machines...
> So far I've determined the best location to be /Library/ 
> LauchdDaemons...even though I would prefer running only after all  
> system services are up and running, and most likely after login.

The "milestone" you're want to depend on no longer exists as far as  
Apple is concerned. Please use our frameworks (a.k.a. shared  
libraries) to monitor the events that you're interested in. Thanks!

> Maintenance items would mostly likely replacing expired software  
> license keys, auto-updating of "in-house" custom applications, and  
> Active Directory password expiration notifications.
> Is this something that can be done with "LimitLoadToSessionType" in  
> Tiger, or is this a Leopard only feature?

LimitLoadToSessionType is a Leopard only feature.

> I haven't been able to find documentation on the session types...?

At the moment, they're documented in Leopard under the launchctl man  
page.

> Our main question relating to this what is the best way to get the  
> shortname of the logged in user in the launchd item running as root?  
> again launched from /Library/LauchdDaemons, this is for running  
> lookups on the user, for group memberships, setting permissions, and  
> notifications...
> Previously we have always used either the system $USER variable or  
> $SUDO_USER when executing as root to get the shortname of the user  
> to initiated the sudo command.
> Neither of these become useful after loading the job into launchd  
> because of the job being run as root, initiated by launchd.

Hmm... It isn't really clear to us what you want. Do you want to run  
as root? Or as the user who is logged in? If think you want both, can  
you please explain why?

Thanks!

davez


More information about the launchd-dev mailing list