Search code examples
bashshelljobs

Relaunch a python script stopped by a CTRL+Z and containing a Fortran executable launched by os.system


I was running a Python script which launches several times a Fortran executable (with os.system('./executable params.ini).

Unfortunately, I did a CTRL+Z to stop the python script but it seems that I have stopped it during the execution of the Fortran executable.

Now, impossible to relaunch the Python script. I tried. :

fg %1

and

bg %1

and

kill -CONT pid_of_executable

But nothing happens ...

So, is there a way to relaunch the python script ? I am frustrated ... if anyone could save my life ... (I am joking)

UPDATE 1: Once Python script stopped by CTRL+Z, pa aux | grep compute gives :

user1              38258   0.0  0.0  6121988  10324 s003  S     3:26PM   0:00.99 /opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python compute_Cl_variable_step_160_between_1e-8_and_1_values_Only_Omega_m_der_to_choose.py
user1              33564   0.0  0.0  6010372  16472 s012  S+    1:34PM   0:01.44 /opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python compute_Cl_variable_step_160_between_1e-8_and_1_values_Only_Omega_m_der_to_choose.py
user1              96299   0.0  0.0  6509060  12668 s004  S+    6:06PM   0:01.77 /opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python compute_Cl_variable_step_160_between_1e-8_and_1_values_Only_Omega_m_der_to_choose.py

Solution

  • With

    jobs
    

    you can see the suspended jobs

    fg jobnummer 
    

    will bring it back.