If
$PID_PARENT
launched $PID_CHILD
, how can I detach (disown
?) $PID_CHILD
from $PID_PARENT
so that, when I kill $PID_PARENT
, $PID_CHILD
keeps running like nothing happened?
Concretely, my $PID_PARENT
is the process running Jenkins
(or the Java
process that runs the server that runs Jenkins) and $PID_CHILD
is a _really long_ job that I don't want to have to restart after restarting Jenkins (which is needed for some maintenance). Essentially, I want to stop Jenkins but not stop the long job it started and I know both PIDs.
**UPDATE 1:** I found out about disown
and tried from a login shell (so not the parent PID shell):
-shell
disown $PID_CHILD
but got
-bash: disown: 13924: no such job
The $PID_CHILD
correct and doing
-shell
ps -o ppid= $PID_CHILD
returns $PID_PARENT
**UPDATE 2:** As per @Rui's answer , I made a temporary hack job in Jenkins that only runs from the parent shell this time:
-shell
disown 13924
but still got
disown: 13924: no such job
Asked by amphibient
(12702 rep)
Jun 27, 2018, 03:44 PM
Last activity: Jul 31, 2023, 03:25 PM
Last activity: Jul 31, 2023, 03:25 PM