Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.
|
|
Yuheng
Posts:
33
Registered:
1/3/11
|
|
Re: How to run matlab in background on a linux server?
Posted:
Jan 5, 2011 1:49 AM
|
|
"Steven_Lord" <slord@mathworks.com> wrote in message <ifvgjv$1du$1@fred.mathworks.com>... > > > "Yuheng " <e2_71828@tom.com> wrote in message > news:ifu0us$i02$1@fred.mathworks.com... > > I tried a command like this: > > > > nohup matlab linux_try.m 1>std.out 2>err.out & > > > > there is only one line in the file linux_try.m, which is > > > > a = magic(5) > > > > but in std.out there are a lot of 'Warning: Error reading character from > > command line', and in err.out there are a lot of 'Bad file descriptor'. > > > > Can anybody help me? Thanks a lot > > Try invoking MATLAB with the -r startup option. > > http://www.mathworks.com/help/techdoc/matlab_env/f8-4994.html > > -- > Steve Lord > slord@mathworks.com > comp.soft-sys.matlab (CSSM) FAQ: http://matlab.wikia.com/wiki/FAQ > To contact Technical Support use the Contact Us link on > http://www.mathworks.com
Thank you for your suggestion, and the link is very helpful.
With an 'exit' added to the end of the script file, the following command works very well
nohup matlab -r "linux_try" -logfile "data.log" 1>stdout.out 2>err.out &
The only small problem is, if the script is not ended with an 'exit'. Matlab will continuously output error messages such as 'Error reading character from command line' and 'Bad file descriptor' in 'data.log', 'stdout.out' and 'err.out', until the process is killed. Do you have any idea of the reason?
At last, I want to thank you again for all your help!
|
|
|
|