I have read about loginctl enable-linger user and /etc/systemd/logind.conf

(KillExcludeUsers=user1 user2 user3)

Oracle Linux: Configure Systemd to Enable User Processes to Continue to Run After Logout

This tutorial shows you how to set up the systemd service manager on an Oracle Linux 8 system to ensure that services and processes that are started by a user continue after the user's session has ended.

Is the tool nohup no longer needed? This functionality is now in systemd?

  • 2
    nohup isn't needed even without systemd. It does absolutely nothing -- not one single thing -- you can't do with just bash builtins alone. (my_nohup() { [ -t 0 ] && exec </dev/null; [ -t 1 ] && exec >nohup.out; [ -t 2 ] && exec 2>&1; "$@" & disown -h "$!"; } is a shell function that does 100% of everything nohup does). Commented Jun 12 at 19:33
  • Mind, if a tool -- systemd or otherwise -- is killing processes in the cgroup created for a now-closed interactive session, it can close them just as well whether or not they were started with nohup (or disconected from the terminal with the techniques above). Commented Jun 12 at 19:40
  • 2
    @CharlesDuffy: To be fair, it does save a lot of typing, which is generally the point of many standard tools. Commented Jun 12 at 19:41
  • @u1686_grawity, perhaps, but then, half the code I provided above is only needed if one doesn't know where stdin, stdout and stderr are going and thus whether redirecting them is called for. In most real-world use cases someone already knows enough about the execution environment to hardcode the redirections (or not). Heck, if you know the shell is noninteractive you can also leave out the -h argument to disown. Commented Jun 12 at 20:52

2 Answers 2


In a way yes, but in the specific context of the Oracle article – definitely no.

Systemd does not change the way ttys function; a terminal that is closed will still deliver a SIGHUP to anything running inside it. So if you start something directly from your interactive shell, as you used to do before, then it still needs nohup to outlive the terminal – just as before.

[Though I think nohup is superfluous in itself; the shell's foo & disown or even (foo &) often does the job well enough, as the SIGHUP is only delivered to the foreground pgroup? Or something along those lines.]

As for KillExcludeUsers – well, the concept of killing all of a user's processes upon logout was introduced by systemd in the first place! It's completely unrelated to terminal hangup; previously there was nothing at all that would cause your processes to be killed after you logged out from GUI or whatever. Indeed that's what allowed tmux or Screen to work in the past.

In other words, systemd is much stricter when it comes to leftover processes by default, and the function of loginctl enable-linger that is described in the post is what allows you to return to the more-permissive pre-systemd behavior of being able to use nohup at all – but by no means makes it superfluous.

What would make nohup superfluous is the other function of linger mode that is not described in the Oracle post: the persistent "user service manager" systemd instance that you can use to start custom services via systemctl --user, or one-off commands via systemd-run --user, which will then be disconnected from your login session and will run for as long as they need to.

  • 6
    On that note, I don't really understand why Oracle admins in particular seem to be so attached to starting actual production services with nohup and screen, even to the extent of complaining on systemd-devel that they're now forced to use a service manager to run a service... Commented Jun 12 at 5:50
  • 3
    Indeed, especially given the history of service management on Solaris! Commented Jun 12 at 5:58
  • 2
    Oracle never has been one for playing nice with others. Back in the day (almost 20 years ago) I did the work to make Oracle RAC play nice in a FHS-type environment (with binaries / things not meant to be modified living on a read-only partition), and it was... not fun. Why anyone would consider it a good idea to mix data and code together in the same structure... shakes head. Commented Jun 12 at 19:38
  • @u1686_grawity: I don't think they should be forced to use a service manager to run a service. Putting a service launcher in rc.local makes some sense.
    – Joshua
    Commented Jun 13 at 19:25
  • execve only reverts the signal disposition of handled signals -- so what nohup does is signal(SIGHUP, SIG_IGN) before running the command, so commands that don't set up their own handlers (which is most text processing tools) will continue to ignore the signal even if it arrives. Commented Jun 14 at 4:22

No, systemd doesn't make nohup redundant. The settings and commands in that article just tell you how to prevent systemd from doing its own extra kills. After turning those off, you're back in the exact same place you were before systemd existed, so you'll still need nohup in all of the situations you did then.


You must log in to answer this question.

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