0

Something like a shell option or "mode" that protects all GUI processes run within that session from being killed when I kill the shell. It would be the equivalent of using nohup for each of the processes.

  • To make this extra clear. I want to be able to kill the shell (including its virtual terminal, or tmux, or screen) without this killing its processes. So no, by shell I did not just mean virtual terminal. – argle Feb 7 '18 at 21:51
  • Shell has no way of knowing whether or not if process is GUI program or not, so I doubt there's a way to "automate" that. Personally, if I know it's a GUI app, I run it with nohup gui_app > /dev/null 2>&1 & right away. – Sergiy Kolodyazhnyy Feb 7 '18 at 22:54
  • Yes, but the shell has no way of knowing whether the process is GUI or not either. – argle Feb 7 '18 at 23:03
  • And your point is ? – Sergiy Kolodyazhnyy Feb 7 '18 at 23:28
  • My nohup mode doesn't care if things break with some applications. It was an argument against "shifting the... question". – argle Feb 8 '18 at 8:37
-1

One solution is to run all commands inside of a terminal multiplexer like tmux or GNU screen. Then if you detach from the tumx or screen session or are disconnected from an ssh session, the commands you are running will continue and not get a SIGHUP. You can reattach and essentially pick up where you left off.

This method is a great way to do any remote administration where you do not want to get disconnected while doing something important or long running.

  • ... unless systemd gets frisky and for some reason nukes some processes – thrig Feb 7 '18 at 19:22
  • also no protection against lasers either. – 111--- Feb 7 '18 at 19:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.