2

As far as I know, nohup signals ignores SIGHUP signal sent by the terminal to the application but the application can change that.

I'm running Spotify through the command nohup spotify & and when I close the terminal by clicking the X symbol on the top corner of the terminal, so does Spotify.

  1. Does this mean Spotify changes it so that it won't ignore SIGHUP signal?
    However, when I close the terminal using exit command, Spotify remains working.

  2. Is the terminal sent different signal when exit command is called? I'd expect the Spotify to terminate as well.

P.S. I am using Elementary OS Loki and xterm.

  • 1
    The usual pitfall is that the application exits because its output has been closed. You might try redirecting its output (including stderr) to /dev/null (ditto for its input). – Thomas Dickey Sep 30 '17 at 15:24
  • @ThomasDickey,s hint is wrong in this case because nohup already handles io, and this does not account for exit working correctly. – hildred Sep 30 '17 at 15:45
  • @ThomasDickey I tried your suggestion just in case but all is same. Also as hildred pointed out, the output goes to nohup.out – Haggra Sep 30 '17 at 16:01
  • @ThomasDickey I knew your name was familiar, I was just checking xterm's Wikipedia page and saw that you are maintaining it. I'd like to know your input further on it. – Haggra Sep 30 '17 at 16:09
  • 1
    gnome-terminal suffers from this same issue, see bugzilla.gnome.org/show_bug.cgi?id=168320 and its duplicates. Redirecting the three standard file descriptors to /dev/null doesn't change a thing for me. I'd also love to understand what is exactly going on, I haven't had time to track it down. You can use disown, e.g. nohup spotify & disown (probably nohup isn't even needed then) as a workaround. – egmont Oct 1 '17 at 21:52
1

Now since you did not say which terminal you were using, I cannot be sure, but The terminal is probably sending a SIGTERM or something else instead of a SIGHUP when it is closed. Three things to do are to read the man page for your terminal emulator, try a different terminal emulator, and to file a bug report on the terminal emulator.

P.S. Which terminal emulator are you using?

  • I tagged it with xterm but it is easy to miss so I edited the question as well. – Haggra Sep 30 '17 at 15:54
  • Well xterm's man page says that it sends SIGHUP when the quit action is invoked, but it also has actions to send any signal and I did not see which is called when it gets a destroy event from the window manager. This may be something you can adjust with resources, but I don't know for sure. – hildred Sep 30 '17 at 16:03

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.