Can you kill a parent process while leaving its child process to complete normally?












0















I'm running a shell script we'll call parent that has a loop. Each iteration in the loop executes something else we'll call child, and when that completes (synchronous/blocking), my script goes to the next iteration.



Is there a way in linux to detach child from the parent process, and then kill parent while leaving the current child to complete normally?



(I think next time I'll include a check inside my loop for the existence of a stop file, and if the file is present, I'll break out of the loop instead of launching the next child. But seeing as the parent that's currently running doesn't have that logic, is there still a way for me to accomplish what I want at the command line?)










share|improve this question























  • in the shell use command <paramenters> & to detach and do not wait for the child to finish

    – matzeri
    Jan 11 at 15:18











  • Compare What happens to background jobs after exiting the shell? and Control which process gets cancelled by Ctrl+C. Your child probably gets SIGHUP from parent or SIGINT from TTY.

    – Kamil Maciorowski
    Jan 11 at 16:53
















0















I'm running a shell script we'll call parent that has a loop. Each iteration in the loop executes something else we'll call child, and when that completes (synchronous/blocking), my script goes to the next iteration.



Is there a way in linux to detach child from the parent process, and then kill parent while leaving the current child to complete normally?



(I think next time I'll include a check inside my loop for the existence of a stop file, and if the file is present, I'll break out of the loop instead of launching the next child. But seeing as the parent that's currently running doesn't have that logic, is there still a way for me to accomplish what I want at the command line?)










share|improve this question























  • in the shell use command <paramenters> & to detach and do not wait for the child to finish

    – matzeri
    Jan 11 at 15:18











  • Compare What happens to background jobs after exiting the shell? and Control which process gets cancelled by Ctrl+C. Your child probably gets SIGHUP from parent or SIGINT from TTY.

    – Kamil Maciorowski
    Jan 11 at 16:53














0












0








0








I'm running a shell script we'll call parent that has a loop. Each iteration in the loop executes something else we'll call child, and when that completes (synchronous/blocking), my script goes to the next iteration.



Is there a way in linux to detach child from the parent process, and then kill parent while leaving the current child to complete normally?



(I think next time I'll include a check inside my loop for the existence of a stop file, and if the file is present, I'll break out of the loop instead of launching the next child. But seeing as the parent that's currently running doesn't have that logic, is there still a way for me to accomplish what I want at the command line?)










share|improve this question














I'm running a shell script we'll call parent that has a loop. Each iteration in the loop executes something else we'll call child, and when that completes (synchronous/blocking), my script goes to the next iteration.



Is there a way in linux to detach child from the parent process, and then kill parent while leaving the current child to complete normally?



(I think next time I'll include a check inside my loop for the existence of a stop file, and if the file is present, I'll break out of the loop instead of launching the next child. But seeing as the parent that's currently running doesn't have that logic, is there still a way for me to accomplish what I want at the command line?)







linux bash shell process






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 10 at 21:38









user3735178user3735178

11




11













  • in the shell use command <paramenters> & to detach and do not wait for the child to finish

    – matzeri
    Jan 11 at 15:18











  • Compare What happens to background jobs after exiting the shell? and Control which process gets cancelled by Ctrl+C. Your child probably gets SIGHUP from parent or SIGINT from TTY.

    – Kamil Maciorowski
    Jan 11 at 16:53



















  • in the shell use command <paramenters> & to detach and do not wait for the child to finish

    – matzeri
    Jan 11 at 15:18











  • Compare What happens to background jobs after exiting the shell? and Control which process gets cancelled by Ctrl+C. Your child probably gets SIGHUP from parent or SIGINT from TTY.

    – Kamil Maciorowski
    Jan 11 at 16:53

















in the shell use command <paramenters> & to detach and do not wait for the child to finish

– matzeri
Jan 11 at 15:18





in the shell use command <paramenters> & to detach and do not wait for the child to finish

– matzeri
Jan 11 at 15:18













Compare What happens to background jobs after exiting the shell? and Control which process gets cancelled by Ctrl+C. Your child probably gets SIGHUP from parent or SIGINT from TTY.

– Kamil Maciorowski
Jan 11 at 16:53





Compare What happens to background jobs after exiting the shell? and Control which process gets cancelled by Ctrl+C. Your child probably gets SIGHUP from parent or SIGINT from TTY.

– Kamil Maciorowski
Jan 11 at 16:53










0






active

oldest

votes











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1392936%2fcan-you-kill-a-parent-process-while-leaving-its-child-process-to-complete-normal%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Super User!


  • 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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1392936%2fcan-you-kill-a-parent-process-while-leaving-its-child-process-to-complete-normal%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

Plaza Victoria

Puebla de Zaragoza

Musa