I have a GCP instance with Ubuntu 18.04, and I'm using GCP secret manager to pull down secrets at boot time with a script in /etc/profile.d, that way I can setup system-wide environment variables that are then used by my other services.
As I understood /etc/profile.d, these get source when a user logins, but my curiosity is that when I reboot the computer, without anyone log in, it seems the scripts were executed because the variables were populated (web server serves the pages just fine, which means the environment variables were set.
Can someone please shed some light on whether this is the right approach for this? And the reason why /etc/profile.d scripts are sourced without any user login?
Why are they executed at boot time?
Thank you!