I have an executable (a server made with Unity) which I want to continue to run after I log out. All the interwebs say that I should be able to accomplish this with nohup or disown or both. But it doesn't work. I do:

nohup /usr/bin/myexecutable &
disown -h

and check the process list at this point, and my process is running. Then I exit and ssh back in, and check the process list again, and it is gone. I have tried it with and without disown, with and without the -h flag, etc., but nothing stops the process from disappearing when I exit the shell.

I can do it with screen or tmux, but I'm trying to set up a simple launch script that nontechnical people on the staff can just log in and run. Any ideas?

(I am running Ubuntu 16.04.6 LTS.)

EDIT: Someone suggested this question, but like in the comment from @mathsyouth, disown does not work for me. @Fox, the author of the only answer to that question, says "If the program you are using still dies on shell-exit with disown, it is a different problem." So it appears this is a different problem. (And as mentioned above, his suggestion of using screen is not helpful in my use case.)

  • 1
    Does this answer your question? Why process killed with nohup Commented Jul 7, 2020 at 18:00
  • I use tmux for those cases. An alternative would be to create a systemd service that runs the executable. You could start or stop it and see its logs in journalctl.
    – kanehekili
    Commented Jul 7, 2020 at 18:15
  • No, @KamilMaciorowski, that does not answer my question — the suggestion to use disown does not work, and I just tried systemd-run, and that does not appear to work either.
    – Joe Strout
    Commented Jul 7, 2020 at 22:54
  • @kanehekili, I mentioned tmux in my question. It's not a solution for our use case. Can you elaborate or point me to a reference on how to create a systemd service?
    – Joe Strout
    Commented Jul 7, 2020 at 22:55
  • Please edit and explicitly state you have checked KillUserProcesses and tried systemd-run, as per this answer. Be specific: include the exact value, the exact command and the exact link. Commented Jul 8, 2020 at 4:19

1 Answer 1


Since tmux or screen is no option, I'd suggest you are using systemd for it. For your example you would create a file (as sudo) with you favorite editor (nano, vim etc) like:

sudo nano /etc/systemd/system/myexecuteable.service

It should contain at least the following:

Description=start my executable after multi-user target



Now you've got two possiblities.

  1. The executable should start whenever the system starts. Then you have to issue sudo systemctl enable myexecutable.service
  2. You want to start it manually. Then issue sudo systemctl start myexecutable.service

In the first case you might have to issue the "systemctl start" command additionally to test it, since "enable" does not imply a "start"

That service will run, even if you leave your session. If that executable has some output (use "logger for that in a bash file) you can check it any time using journalctl -u myexecutable.service

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .