There are a lot of variables involved. Typically a process started in the background (e.g. by SysV init, systemd or cron) has no tty/pty assigned. You see a ? in the field for that when running "ps -ef". You would also see that if you had nohup'ed a process you started in backgroun on a terminal then closed the terminal.
This
discussion talks about various ideas, none of which have I tried but it might be useful:
If it is something you are starting manually in background from a terminal you might want to start it with "
screen".
If this is starting in background as a GUI you may be able to use something like Xvfb to manage it.