remote process run through ssh gets killed if UI is closed

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
0
down vote

favorite












I have written a script which essentially does 2 things:



  • Runs a UI for listening to the actual program running on the server

  • remotely run the program on the server

All goes well, the UI starts, then the program is run on the server. But as soon as I close the UI the remote process gets killed.



Relevant portions of the script:



ui_pid = subprocess.check_output('/home/user/git/sim_ui.sh', shell=True)
command = 'ssh user@server "bash -c 'cd program_dir/ && echo "running program >> log.out && ./program.sh >> log.out'"'
print command
os.system(command)


sim_ui.sh:



nohup ui_binary args > ui_out.txt &


I also am unable to find out what killed the process on the server i.e. signal which terminated the process and where it originated from.



Edit:
When I add screen -dm before bash -c it works perfectly.







share|improve this question





















  • I assume there is some kind of communication between the UI and the program running on the server?
    – koalo
    Jul 27 at 8:27










  • @koalo Yes. But not of the kind where the remote program terminates upon closing the UI. When I add screen -dm before bash -c everything works perfectly.
    – user3286661
    Jul 27 at 8:30










  • I could not understand, what did happen when run nohup ui_binary args > ui_out.txt &?
    – Hossein Vatani
    Jul 27 at 10:39
















up vote
0
down vote

favorite












I have written a script which essentially does 2 things:



  • Runs a UI for listening to the actual program running on the server

  • remotely run the program on the server

All goes well, the UI starts, then the program is run on the server. But as soon as I close the UI the remote process gets killed.



Relevant portions of the script:



ui_pid = subprocess.check_output('/home/user/git/sim_ui.sh', shell=True)
command = 'ssh user@server "bash -c 'cd program_dir/ && echo "running program >> log.out && ./program.sh >> log.out'"'
print command
os.system(command)


sim_ui.sh:



nohup ui_binary args > ui_out.txt &


I also am unable to find out what killed the process on the server i.e. signal which terminated the process and where it originated from.



Edit:
When I add screen -dm before bash -c it works perfectly.







share|improve this question





















  • I assume there is some kind of communication between the UI and the program running on the server?
    – koalo
    Jul 27 at 8:27










  • @koalo Yes. But not of the kind where the remote program terminates upon closing the UI. When I add screen -dm before bash -c everything works perfectly.
    – user3286661
    Jul 27 at 8:30










  • I could not understand, what did happen when run nohup ui_binary args > ui_out.txt &?
    – Hossein Vatani
    Jul 27 at 10:39












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I have written a script which essentially does 2 things:



  • Runs a UI for listening to the actual program running on the server

  • remotely run the program on the server

All goes well, the UI starts, then the program is run on the server. But as soon as I close the UI the remote process gets killed.



Relevant portions of the script:



ui_pid = subprocess.check_output('/home/user/git/sim_ui.sh', shell=True)
command = 'ssh user@server "bash -c 'cd program_dir/ && echo "running program >> log.out && ./program.sh >> log.out'"'
print command
os.system(command)


sim_ui.sh:



nohup ui_binary args > ui_out.txt &


I also am unable to find out what killed the process on the server i.e. signal which terminated the process and where it originated from.



Edit:
When I add screen -dm before bash -c it works perfectly.







share|improve this question













I have written a script which essentially does 2 things:



  • Runs a UI for listening to the actual program running on the server

  • remotely run the program on the server

All goes well, the UI starts, then the program is run on the server. But as soon as I close the UI the remote process gets killed.



Relevant portions of the script:



ui_pid = subprocess.check_output('/home/user/git/sim_ui.sh', shell=True)
command = 'ssh user@server "bash -c 'cd program_dir/ && echo "running program >> log.out && ./program.sh >> log.out'"'
print command
os.system(command)


sim_ui.sh:



nohup ui_binary args > ui_out.txt &


I also am unable to find out what killed the process on the server i.e. signal which terminated the process and where it originated from.



Edit:
When I add screen -dm before bash -c it works perfectly.









share|improve this question












share|improve this question




share|improve this question








edited Jul 27 at 8:31
























asked Jul 27 at 8:17









user3286661

1011




1011











  • I assume there is some kind of communication between the UI and the program running on the server?
    – koalo
    Jul 27 at 8:27










  • @koalo Yes. But not of the kind where the remote program terminates upon closing the UI. When I add screen -dm before bash -c everything works perfectly.
    – user3286661
    Jul 27 at 8:30










  • I could not understand, what did happen when run nohup ui_binary args > ui_out.txt &?
    – Hossein Vatani
    Jul 27 at 10:39
















  • I assume there is some kind of communication between the UI and the program running on the server?
    – koalo
    Jul 27 at 8:27










  • @koalo Yes. But not of the kind where the remote program terminates upon closing the UI. When I add screen -dm before bash -c everything works perfectly.
    – user3286661
    Jul 27 at 8:30










  • I could not understand, what did happen when run nohup ui_binary args > ui_out.txt &?
    – Hossein Vatani
    Jul 27 at 10:39















I assume there is some kind of communication between the UI and the program running on the server?
– koalo
Jul 27 at 8:27




I assume there is some kind of communication between the UI and the program running on the server?
– koalo
Jul 27 at 8:27












@koalo Yes. But not of the kind where the remote program terminates upon closing the UI. When I add screen -dm before bash -c everything works perfectly.
– user3286661
Jul 27 at 8:30




@koalo Yes. But not of the kind where the remote program terminates upon closing the UI. When I add screen -dm before bash -c everything works perfectly.
– user3286661
Jul 27 at 8:30












I could not understand, what did happen when run nohup ui_binary args > ui_out.txt &?
– Hossein Vatani
Jul 27 at 10:39




I could not understand, what did happen when run nohup ui_binary args > ui_out.txt &?
– Hossein Vatani
Jul 27 at 10:39















active

oldest

votes











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
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',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f458777%2fremote-process-run-through-ssh-gets-killed-if-ui-is-closed%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes










 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f458777%2fremote-process-run-through-ssh-gets-killed-if-ui-is-closed%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Displaying single band from multi-band raster using QGIS

How many registers does an x86_64 CPU actually have?