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.
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).nohup
(or disconected from the terminal with the techniques above).-h
argument todisown
.