An update to the previous comment. It is true that typing `nohup emacs &` directly into the shell does not help, i.e., Emacs dies when the shell dies. Example:
The parent of the emacs process is still bash, so when bash dies, Emacs dies too.
However, invoking `nohup emacs &` from another shell script does work. The PPID of Emacs gets assigned to 1 and Emacs continues to keep running even after killing the shell. Example:
In the second experiment, the parent of the emacs process is the init process, to it continues to run successfully even after the shell or terminal exits.
To summarize, yes, we can use nohup in the startup script and make it POSIX compliant.
However, invoking `nohup emacs &` from another shell script does work. The PPID of Emacs gets assigned to 1 and Emacs continues to keep running even after killing the shell. Example:
In the second experiment, the parent of the emacs process is the init process, to it continues to run successfully even after the shell or terminal exits.To summarize, yes, we can use nohup in the startup script and make it POSIX compliant.