[launchd-dev] Environment Variables and LimitLoadToSessionType?

Matthew Hansen mahansen2573 at winona.edu
Mon Oct 15 11:59:23 PDT 2007


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.
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? I haven't been able to find  
documentation on the session types...?

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.

Thanks,

Matt


More information about the launchd-dev mailing list