Score:1

Is there a way to dynamically set global environment variables for all users, daemons, and background processes?

mw flag

I have been trying to reach out to an external data source and dynamically assign the payload contents to environment variables on each startup. I've gotten this half working by running a script in /profile.d, but the variables are made available only for users that login rather than processes started by the system on boot. I've been researching this and cannot seem to find an answer so I'm unsure if it's even possible.

tl;dr: how do you dynamically set environment variables via a script once on boot such that those variables are static for as long as the vm is up and globally available to every process and user?

Pianoman avatar
uz flag
I do not exactly know where to set this up, but I can explain a little on how environment variables work. The point is that the first process (usually with id 1) has a basic set of these variables. Each process that is started (forked) from that process will receive its own copy of this environment. There is no way to influence the parent's environment anymore. So the key of your problem is to find which processes you want to have all this information, and find a common parent that is able to setup this info. use `ps fax` from bash to see the process tree
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.