Why does `disown -h` make chromium-browser survive closing its terminal emulator tab?
up vote
-2
down vote
favorite
In Why is chromium-browser killed when I close the terminal despite nohup?, I wrote that in a Terminal emulator tab, I ran
$ nohup chromium-browser &
When I close the terminal tab, chromium-browser also exits. Mark replied it was because chromium-browser overrides the action of SIGHUP from ignore to default (terminate).
When I repeat the above with disown -h
in place of nohup
,
$ chromium-browser & disown -h
why doesn't chromium-browser terminate when I close its terminal tab? (Note that disown -h
doesn't remove the chromium-browser process from the job list in the shell, so I think the chromium-browser process still receives SIGHUP from the shell)
Thanks.
bash disown chromium-browser
add a comment |
up vote
-2
down vote
favorite
In Why is chromium-browser killed when I close the terminal despite nohup?, I wrote that in a Terminal emulator tab, I ran
$ nohup chromium-browser &
When I close the terminal tab, chromium-browser also exits. Mark replied it was because chromium-browser overrides the action of SIGHUP from ignore to default (terminate).
When I repeat the above with disown -h
in place of nohup
,
$ chromium-browser & disown -h
why doesn't chromium-browser terminate when I close its terminal tab? (Note that disown -h
doesn't remove the chromium-browser process from the job list in the shell, so I think the chromium-browser process still receives SIGHUP from the shell)
Thanks.
bash disown chromium-browser
1
what makes you think so? runhelp disown
in bash and read the definition of the-h
option 50 times ;-)
– mosvy
Nov 27 at 2:03
add a comment |
up vote
-2
down vote
favorite
up vote
-2
down vote
favorite
In Why is chromium-browser killed when I close the terminal despite nohup?, I wrote that in a Terminal emulator tab, I ran
$ nohup chromium-browser &
When I close the terminal tab, chromium-browser also exits. Mark replied it was because chromium-browser overrides the action of SIGHUP from ignore to default (terminate).
When I repeat the above with disown -h
in place of nohup
,
$ chromium-browser & disown -h
why doesn't chromium-browser terminate when I close its terminal tab? (Note that disown -h
doesn't remove the chromium-browser process from the job list in the shell, so I think the chromium-browser process still receives SIGHUP from the shell)
Thanks.
bash disown chromium-browser
In Why is chromium-browser killed when I close the terminal despite nohup?, I wrote that in a Terminal emulator tab, I ran
$ nohup chromium-browser &
When I close the terminal tab, chromium-browser also exits. Mark replied it was because chromium-browser overrides the action of SIGHUP from ignore to default (terminate).
When I repeat the above with disown -h
in place of nohup
,
$ chromium-browser & disown -h
why doesn't chromium-browser terminate when I close its terminal tab? (Note that disown -h
doesn't remove the chromium-browser process from the job list in the shell, so I think the chromium-browser process still receives SIGHUP from the shell)
Thanks.
bash disown chromium-browser
bash disown chromium-browser
edited Nov 26 at 22:29
asked Nov 26 at 22:14
Tim
25.1k72243441
25.1k72243441
1
what makes you think so? runhelp disown
in bash and read the definition of the-h
option 50 times ;-)
– mosvy
Nov 27 at 2:03
add a comment |
1
what makes you think so? runhelp disown
in bash and read the definition of the-h
option 50 times ;-)
– mosvy
Nov 27 at 2:03
1
1
what makes you think so? run
help disown
in bash and read the definition of the -h
option 50 times ;-)– mosvy
Nov 27 at 2:03
what makes you think so? run
help disown
in bash and read the definition of the -h
option 50 times ;-)– mosvy
Nov 27 at 2:03
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
chromium is a bit complicated, so let's use sleep instead.
$ nohup sleep 1000 >& /dev/null &
[1] 5283
Here we have a sleep process that ignores HUP. Demonstrate by sending HUP:
$ kill -SIGHUP 5283
$ kill -SIGHUP 5283
$ kill -SIGHUP 5283
See? Nothing happens.
Let's try this again with disown:
$ sleep 1000 &
[1] 5293
$ disown -h
Here we have a sleep process that doesn't ignore HUP. Demonstrate by sending HUP:
$ kill -SIGHUP 5293
$ kill -SIGHUP 5293
bash: kill: (5293) - No such process
[1]+ Hangup sleep 1000
Hups, it died.
You can also do this in a new terminal after closing the old one. So apparently, closing the terminal does not send HUP after disown -h.
So why doesn't nohup chromium ignore HUP? nohup sets HUP to ignore, but chromium may choose to revert that. So nohup is super uneffective on processes that have their own ideas about signal handlers.
One way to make a process that chooses to not ignore HUP to ignore HUP anyway is to not send HUP in the first place so it won't know about the HUP and doesn't matter whether or how it handles HUP.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
chromium is a bit complicated, so let's use sleep instead.
$ nohup sleep 1000 >& /dev/null &
[1] 5283
Here we have a sleep process that ignores HUP. Demonstrate by sending HUP:
$ kill -SIGHUP 5283
$ kill -SIGHUP 5283
$ kill -SIGHUP 5283
See? Nothing happens.
Let's try this again with disown:
$ sleep 1000 &
[1] 5293
$ disown -h
Here we have a sleep process that doesn't ignore HUP. Demonstrate by sending HUP:
$ kill -SIGHUP 5293
$ kill -SIGHUP 5293
bash: kill: (5293) - No such process
[1]+ Hangup sleep 1000
Hups, it died.
You can also do this in a new terminal after closing the old one. So apparently, closing the terminal does not send HUP after disown -h.
So why doesn't nohup chromium ignore HUP? nohup sets HUP to ignore, but chromium may choose to revert that. So nohup is super uneffective on processes that have their own ideas about signal handlers.
One way to make a process that chooses to not ignore HUP to ignore HUP anyway is to not send HUP in the first place so it won't know about the HUP and doesn't matter whether or how it handles HUP.
add a comment |
up vote
1
down vote
chromium is a bit complicated, so let's use sleep instead.
$ nohup sleep 1000 >& /dev/null &
[1] 5283
Here we have a sleep process that ignores HUP. Demonstrate by sending HUP:
$ kill -SIGHUP 5283
$ kill -SIGHUP 5283
$ kill -SIGHUP 5283
See? Nothing happens.
Let's try this again with disown:
$ sleep 1000 &
[1] 5293
$ disown -h
Here we have a sleep process that doesn't ignore HUP. Demonstrate by sending HUP:
$ kill -SIGHUP 5293
$ kill -SIGHUP 5293
bash: kill: (5293) - No such process
[1]+ Hangup sleep 1000
Hups, it died.
You can also do this in a new terminal after closing the old one. So apparently, closing the terminal does not send HUP after disown -h.
So why doesn't nohup chromium ignore HUP? nohup sets HUP to ignore, but chromium may choose to revert that. So nohup is super uneffective on processes that have their own ideas about signal handlers.
One way to make a process that chooses to not ignore HUP to ignore HUP anyway is to not send HUP in the first place so it won't know about the HUP and doesn't matter whether or how it handles HUP.
add a comment |
up vote
1
down vote
up vote
1
down vote
chromium is a bit complicated, so let's use sleep instead.
$ nohup sleep 1000 >& /dev/null &
[1] 5283
Here we have a sleep process that ignores HUP. Demonstrate by sending HUP:
$ kill -SIGHUP 5283
$ kill -SIGHUP 5283
$ kill -SIGHUP 5283
See? Nothing happens.
Let's try this again with disown:
$ sleep 1000 &
[1] 5293
$ disown -h
Here we have a sleep process that doesn't ignore HUP. Demonstrate by sending HUP:
$ kill -SIGHUP 5293
$ kill -SIGHUP 5293
bash: kill: (5293) - No such process
[1]+ Hangup sleep 1000
Hups, it died.
You can also do this in a new terminal after closing the old one. So apparently, closing the terminal does not send HUP after disown -h.
So why doesn't nohup chromium ignore HUP? nohup sets HUP to ignore, but chromium may choose to revert that. So nohup is super uneffective on processes that have their own ideas about signal handlers.
One way to make a process that chooses to not ignore HUP to ignore HUP anyway is to not send HUP in the first place so it won't know about the HUP and doesn't matter whether or how it handles HUP.
chromium is a bit complicated, so let's use sleep instead.
$ nohup sleep 1000 >& /dev/null &
[1] 5283
Here we have a sleep process that ignores HUP. Demonstrate by sending HUP:
$ kill -SIGHUP 5283
$ kill -SIGHUP 5283
$ kill -SIGHUP 5283
See? Nothing happens.
Let's try this again with disown:
$ sleep 1000 &
[1] 5293
$ disown -h
Here we have a sleep process that doesn't ignore HUP. Demonstrate by sending HUP:
$ kill -SIGHUP 5293
$ kill -SIGHUP 5293
bash: kill: (5293) - No such process
[1]+ Hangup sleep 1000
Hups, it died.
You can also do this in a new terminal after closing the old one. So apparently, closing the terminal does not send HUP after disown -h.
So why doesn't nohup chromium ignore HUP? nohup sets HUP to ignore, but chromium may choose to revert that. So nohup is super uneffective on processes that have their own ideas about signal handlers.
One way to make a process that chooses to not ignore HUP to ignore HUP anyway is to not send HUP in the first place so it won't know about the HUP and doesn't matter whether or how it handles HUP.
answered Nov 26 at 22:54
frostschutz
25.6k15280
25.6k15280
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f484315%2fwhy-does-disown-h-make-chromium-browser-survive-closing-its-terminal-emulator%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
what makes you think so? run
help disown
in bash and read the definition of the-h
option 50 times ;-)– mosvy
Nov 27 at 2:03