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)
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.
When I add
screen -dm before
bash -c it works perfectly.