Running scripts in the background

From Dynamo
Revision as of 19:43, 18 November 2020 by Daniel Castaño (talk | contribs) (Created page with "This information refers to Linux and Mac operative systems = The nohup command = The <t>nohup</tt> command allows to run a command in the background, in a fashion that interru...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This information refers to Linux and Mac operative systems

The nohup command

The <t>nohup command allows to run a command in the background, in a fashion that interruptions of the connection will not terminate the job. The terminal containing the job might get closed and the job will still carry on. In order to keep track of the PID (process identifier) assigned by the process to the command launched, remember to use the & at the end of the line that invokes nohup. This PID might be needed to interrupt the execution of the background job.

Retrieving the PID of your process

Use the pgrep command, followed by the command that you nohup-ed. For instance:

pgrep MATLAB

to locate PIDs that carry a MATLAB process. Note that in your system, capital letters might not apply

Running Matlab scripts

With a license

If you want to run the script myTest.m through nohup, the advised syntax is:

nohup -nosplash matlab < myTest.m > output.txt & 

where

  • no splash inhibited the popup of the Matlab welcome window
  • output.txt is a text file that will catch the text that would be shown in the screen if the script would be ran directly (instead of through nohup).

With the standalone

Matlab scripts including Dynamo commands

Remember that you need to include a line that activates 'Dynamo' inside the script that you submit into nohup.

Running projects in the background

'Dynamo' projects can be run directly by nohup. A project script myProject.exe can be ran by

nohup myProject.exe