1

I have made some command (at /usr/bin) to Run Application like Matlab, Weka etc in Ubuntu 18.04 LTS. While using Matlab command, it holds the Terminal until I close Matlab or Terminal (if I close Terminal, Matlab also closed). How can I avoid this problem, that means Matlab command will not hold terminal while working? Thank You.

The Following Format has worked before but suddenly not working.

#!/bin/bash

setsid /usr/local/MATLAB/R2018a/bin/matlab </dev/null >/dev/null 2>&1 & disown

Now Matlab just open the logo but no further work going on....

2
  • Has there been any recent update for Matlab that you recall ? – Sergiy Kolodyazhnyy Feb 20 '19 at 2:10
  • not exactly...................... – Shaikat Saha Feb 20 '19 at 12:42
0

In this case nohup [CMD] & is a good alternative. nohup frees the command from the terminal running it and makes it immune to terminal hangups.

Also, the command you posted opens a new session and immediately sends EOF with </dev/null which forces matlab to not accept any input from terminal. This might be an issue depending on how a given program executes upon opening. I also do not think disown serves any purpose here, as the & runs it in the background and setsid should free it from the terminal. disown does not disconnect the program from the terminal, it only removes it from the job list. In any case, I'd use nohup [CMD] & as it does

1) separate the program from the terminal running it

2) closes standard input

3) redirects stdout and stderr to a separate file for examination instead of just sending it into the /dev/null abyss

4) & at the end puts it in the background

1
  • please upvote if helpful – Neticegear Feb 21 '19 at 0:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.