You can't find the “owner shell” in the sense you're describing, because there's no such thing. You can find the parent process, which may be a shell; but you can't know whether the shell disowned the job, because that operation is purely internal to the shell.
What you should really do is instruct your users to start long-running programs inside Screen or Tmux. These are somewhat complex programs, but for basic use, they are very simple.
- Start a Screen session by running the command
screen
. - You can run commands inside that session, and they'll keep running even if you log out.
- If you want to log out with a command still running, disconnect from the Screen session by typing Ctrl+A D.
- To reconnect to an existing Screen session, run
screen -rd
. - If you exit the shell inside a Screen session, the session exits.
You could perhaps make a wrapper script around long-running processes that starts screen
automatically.