* How to trigger Yocto Linux /etc/profile or shell scripts in /etc/profile.d without shell logging in? @ 2021-10-11 4:29 Jupiter 2021-10-11 4:40 ` [OE-core] " Chuck Wolber 2021-10-11 4:43 ` Federico Pellegrin 0 siblings, 2 replies; 5+ messages in thread From: Jupiter @ 2021-10-11 4:29 UTC (permalink / raw) To: yocto; +Cc: OE 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [OE-core] How to trigger Yocto Linux /etc/profile or shell scripts in /etc/profile.d without shell logging in? 2021-10-11 4:29 How to trigger Yocto Linux /etc/profile or shell scripts in /etc/profile.d without shell logging in? Jupiter @ 2021-10-11 4:40 ` Chuck Wolber 2021-10-11 4:43 ` Federico Pellegrin 1 sibling, 0 replies; 5+ messages in thread From: Chuck Wolber @ 2021-10-11 4:40 UTC (permalink / raw) To: JH; +Cc: yocto, OE [-- Attachment #1: Type: text/plain, Size: 679 bytes --] On Sun, Oct 10, 2021 at 9:30 PM JH <jupiter.hce@gmail.com> wrote: > 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? > What problem are you attempting to solve by running a script from /etc/profile.d? ..Ch:W.. -- *"Perfection must be reached by degrees; she requires the slow hand of time." - Voltaire* [-- Attachment #2: Type: text/html, Size: 1166 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [OE-core] How to trigger Yocto Linux /etc/profile or shell scripts in /etc/profile.d without shell logging in? 2021-10-11 4:29 How to trigger Yocto Linux /etc/profile or shell scripts in /etc/profile.d without shell logging in? Jupiter 2021-10-11 4:40 ` [OE-core] " Chuck Wolber @ 2021-10-11 4:43 ` Federico Pellegrin 2021-10-11 9:04 ` Jupiter 1 sibling, 1 reply; 5+ messages in thread From: Federico Pellegrin @ 2021-10-11 4:43 UTC (permalink / raw) To: JH; +Cc: yocto, OE [-- Attachment #1: Type: text/plain, Size: 1412 bytes --] Hi Jupiter, /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. 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. HTH, Federico Il giorno lun 11 ott 2021 alle ore 06:30 JH <jupiter.hce@gmail.com> 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 > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#156808): > https://lists.openembedded.org/g/openembedded-core/message/156808 > Mute This Topic: https://lists.openembedded.org/mt/86229953/5117409 > Group Owner: openembedded-core+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ > fede@evolware.org] > -=-=-=-=-=-=-=-=-=-=-=- > > [-- Attachment #2: Type: text/html, Size: 2333 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [OE-core] How to trigger Yocto Linux /etc/profile or shell scripts in /etc/profile.d without shell logging in? 2021-10-11 4:43 ` Federico Pellegrin @ 2021-10-11 9:04 ` Jupiter 2021-10-12 2:59 ` Federico Pellegrin 0 siblings, 1 reply; 5+ messages in thread From: Jupiter @ 2021-10-11 9:04 UTC (permalink / raw) To: Federico Pellegrin; +Cc: yocto, OE 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@gmail.com> 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 >> >> -=-=-=-=-=-=-=-=-=-=-=- >> Links: You receive all messages sent to this group. >> View/Reply Online (#156808): >> https://lists.openembedded.org/g/openembedded-core/message/156808 >> Mute This Topic: https://lists.openembedded.org/mt/86229953/5117409 >> Group Owner: openembedded-core+owner@lists.openembedded.org >> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ >> fede@evolware.org] >> -=-=-=-=-=-=-=-=-=-=-=- >> >> > -- "A man can fail many times, but he isn't a failure until he begins to blame somebody else." -- John Burroughs ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [OE-core] How to trigger Yocto Linux /etc/profile or shell scripts in /etc/profile.d without shell logging in? 2021-10-11 9:04 ` Jupiter @ 2021-10-12 2:59 ` Federico Pellegrin 0 siblings, 0 replies; 5+ messages in thread From: Federico Pellegrin @ 2021-10-12 2:59 UTC (permalink / raw) To: Jupiter; +Cc: yocto, OE [-- Attachment #1: Type: text/plain, Size: 4069 bytes --] Hi Jupiter, To centralize, agreed that you are using systemd, one way I could see is setting the variables in systemd-system.conf using the DefaultEnvironment directive, see: https://freedesktop.org/software/systemd/man/systemd-system.conf.html This states: ---- DefaultEnvironment=¶ <https://freedesktop.org/software/systemd/man/systemd-system.conf.html#DefaultEnvironment=> Configures environment variables passed to all executed processes. Takes a space-separated list of variable assignments. See environ(7) <http://man7.org/linux/man-pages/man7/environ.7.html> for details about environment variables. Simple "%"-specifier expansion is supported, see below for a list of supported specifiers. Example: DefaultEnvironment="VAR1=word1 word2" VAR2=word3 "VAR3=word 5 6" Sets three variables "VAR1", "VAR2", "VAR3". ---- This should have you variables management in each. Otherwise as you mention one can put in each script with either Environment to have them explicitly enumerated or with EnvironmentFile to read from a file, which may also fit your centralization hopes (but still require one line per startup script at least) and could be further sourced by non-systemd components as well if needed. (https://www.freedesktop.org/software/systemd/man/systemd.exec.html under Environment section) HTH, Federico Il giorno lun 11 ott 2021 alle ore 11:05 Jupiter <jupiter.hce@gmail.com> ha scritto: > 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@gmail.com> 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 > >> > >> -=-=-=-=-=-=-=-=-=-=-=- > >> Links: You receive all messages sent to this group. > >> View/Reply Online (#156808): > >> https://lists.openembedded.org/g/openembedded-core/message/156808 > >> Mute This Topic: https://lists.openembedded.org/mt/86229953/5117409 > >> Group Owner: openembedded-core+owner@lists.openembedded.org > >> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ > >> fede@evolware.org] > >> -=-=-=-=-=-=-=-=-=-=-=- > >> > >> > > > > > -- > "A man can fail many times, but he isn't a failure until he begins to > blame somebody else." > -- John Burroughs > [-- Attachment #2: Type: text/html, Size: 6197 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-10-12 3:00 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-10-11 4:29 How to trigger Yocto Linux /etc/profile or shell scripts in /etc/profile.d without shell logging in? Jupiter 2021-10-11 4:40 ` [OE-core] " Chuck Wolber 2021-10-11 4:43 ` Federico Pellegrin 2021-10-11 9:04 ` Jupiter 2021-10-12 2:59 ` Federico Pellegrin
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).