Hello and thanks in advance for any help anyone can offer to straighten me out on this subject
I'm trying to understand non-interactive & non-login shells and having a hard time conceptualize the process a non-interactive & non-login shell goes through to start up. Particularly for background processes.
The way I understand things is when a process is started.... a region of memory is created and the child process replicates a duplicate environment of the parent by being forked. What's confusing me is when is the shell environment defined for a background process? When I think about how an interactive shell is started I get a little lost.
The way I understand an interactive shell is:
- User passes login ID to Linux kernel
- Linux kernel looks the user up in the /etc/password file and identifies the assigned shell
- the shell is started
- the shell reads the login scripts to define the shell environment for the user
- Linux produces a command prompt to indicate the shell is ready to accept commands
Do processes that start in the background have a similar process it steps through? This is how I envision it working:
- The process is forked by the parent process
- Linux identifies the user ID the process will runs as
- Linux looks the user id up in the /etc/passwd file
- the shell is started
- the BASH_ENV is read (If it was defined)
- the process interacts with the shell to pass commands to the API
For example... An Oracle database would have the user ID of oracle and be assigned the /bin/bash shell... Would this process accurately describe what it goes through when it starts?
For some reason this seems clunky and like I'm missing something... Could someone let me know if I'm on the right path please?
Thank you very much!