Считайте, что этот фрагмент сохранен в файле с именем snippet.sh
:
nohup xmessage HI </dev/null &>/dev/null & disown
sleep 3
. Из того же каталога выполните xterm -e bash snippet.sh
.
. Через 3 секунды xterm
должно исчезнуть, пока окно xmessage
задерживается. Все хорошо и хорошо. Но что, если nohup
будет удален из команды в файле сниппета? Тогда xmessage
, который исчезает вместе с xterm
. Документация bash
, кажется, указывает, что disown
должно быть достаточно, чтобы предотвратить отправку SIGHUP
:
The shell exits by default upon receipt of a SIGHUP. Before exiting, an interactive shell resends
the SIGHUP to all jobs, running or stopped. Stopped jobs are sent SIGCONT to ensure that they
receive the SIGHUP. To prevent the shell from sending the signal to a particular job, it should be
removed from the jobs table with the disown builtin (see SHELL BUILTIN COMMANDS below) or marked to
not receive SIGHUP using disown -h.
Итак, вопрос в том, почему не будет xmessage
окно задерживается без nohup
?