I am trying to do something like the following. Right now I am connecting via ssh to a remote computer and starting my analysis with the nohup command as
nohup matlab -nodesktop -nodisplay < mycode.m > output.txt 2>&1 &
Now I want to write a script that runs in the background with several nohup commands one after another. I managed to do
#!/bin/bash matlab -nodesktop -nodisplay -r "mycode;quit;" > output.txt
But not only does the code work with only one processor, but also in an infinite loop and never ends.
Can i solve this? It is important that I can close the terminal after running script.sh
EDIT: Thanks to you, I can do and let the next thing work well.
ssh user@ipaddress screen cd folder1/ nohup matlab -nodesktop -nodisplay < mycode.m > output.txt 2>&1 & exit screen cd folder2/ nohup matlab -nodesktop -nodisplay < mycode.m > output.txt 2>&1 & exit
Can I make a script now? Since I noticed that at any time when I type screen , I have to press Enter immediately after.
EDIT2: @Peter I did what you suggested
#!/bin/bash cd folder1/ matlab -nodesktop -nodisplay -r "mycode;quit;" < /dev/null > output.txt cd folder2/ matlab -nodesktop -nodisplay -r "mycode;quit;" < /dev/null > output.txt
But only the first matlab works, how is this possible?
source share