Find the answer to your Linux question:
Results 1 to 3 of 3
Hello, here's my problem: I have a simulation that takes an awful long time to run (written in C++), but it is possible to split up the simulation into several ...
  1. #1
    Just Joined!
    Join Date
    Jun 2009
    Posts
    5

    Angry Fork process off of Bash script

    Hello, here's my problem:

    I have a simulation that takes an awful long time to run (written in C++), but it is possible to split up the simulation into several parts. In an effort to do this, I have created a python script that connects to various machines on the network (it uses ssh via the paramiko module). After connecting to each machine, it attempts to execute a script that is supposed to fork the C++ program off running its little 'piece'.

    So here's the problem:
    After running my python program, I check to see if the C++ program is running on the computer that I had ssh'd into, but it is not running. It seems to me that after closing the ssh connection, all child processes of the bash script got killed.

    Here is the script in question (with program names and arguments changed for simplicity):

    <begin simrun.sh>
    #!/bin/bash
    CMD="( ( ../SimulationProgram [args...] ) > [outfile]) &" # shouldn't the '&' fork the process???

    eval $CMD
    echo "Success."
    wait $! #should I even need this?
    <end simrun.sh>

    Also interesting to note: the python program that ssh's is able to read the "Success." message from the script's output stream...

    Any thoughts/suggestions/criticisms would be greatly appreciated!

  2. #2
    Linux Guru
    Join Date
    Nov 2007
    Posts
    1,695

  3. #3
    Just Joined!
    Join Date
    Jun 2009
    Posts
    5
    Thanks for your prompt reply.

    I tried nohup, as well as disown, disown -h, and at, and none of them seem to work.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...