Re: [OE-core] How to trigger Yocto Linux /etc/profile or shell scripts in /etc/profile.d without shell logging in?


JH
 

Hi Federico,

Thanks for your response.

/etc/profile and similar are interactive shell (/bash) concepts, not really
system startup ones. So indeed: just on a login (be it local, ssh and so
on) they are executed.
Understood, here is what I try to figure out. I use several systemd
services to start my tasks, each task is not just a system process, I
found it also has a system environment similar in user login from
/etcprofile, /home/user/.profile, my question is where is a system
environment file that each systemd service runs from?

I also thought that /etc/profile.d files should be automatically
invoked for each user login, but a systemd service does not run
/etc/profile.d files.

If you want to execute something else without the need for logging it, you
should look elsewhere, depending on your system manager: if systemd you
should create a service and enable it, if sysvinit a init.d script.
Understood, that was what I did originally, I have to run the setup
system environment in each service ExecStart script, that is why I am
looking for a global environment setup file to avoid duplication of
putting my environment scripts in each ExecStart execution file.

Thank you.

Kind regards,

- jupiter

HTH,
Federico


Il giorno lun 11 ott 2021 alle ore 06:30 JH <jupiter.hce@...> ha
scritto:

Hi,

The Yocto uses /etc/profile for root login, but there is no root
physical login in an embedded device so the /etc/profile is never
called, I added a shell script to /etc/profile.d, it was not called
either. Both /etc/profile and scripts in /etc/profile.d can only be
invoked when I physically log into the debug console, that is
impractical. Appreciate your advice, how do you resolve that kind of
problem?

Thank you.

Kind regards,

- jupiter




--
"A man can fail many times, but he isn't a failure until he begins to
blame somebody else."
-- John Burroughs

Join yocto@lists.yoctoproject.org to automatically receive all group messages.