Hi,
We have a service (written in .NET) that is launched like this:
sudo launchctl load /Library/LaunchDaemons/<myApp.plist>
Note: It runs as root
user as defined in plist
The service needs to access environment variables set by other apps. .NET code used to read the env variable is Environment.GetEnvironmentVariable
- If the variable is setup by ~/.bash_profile - it is available in all terminal windows but the when the myApp service is loaded, the .NET code above is not able to see/read that env variable.
- The above .NET code is able to get teh value of the env variable only if the variable is added into
myApp.plist
But, we don't want other apps to modify myApp's plist. Is there any way that an other app can set an env variable and myApp can access the value?