• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

[CentOSServer]Bugwhencallingmatlabinbash

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

尝试了好几遍,仍然不能用简写命令调用matlab,这里把过程记录如下。

(1). 登录 server

[She@She ~]$ ssh [email protected]
Last login: Mon Aug 15 10:59:03 2016 from xx.xx.xx.xx
-bash: module: command not found
-bash: module: command not found
-bash: setenv: command not found
-bash: setenv: command not found
bash: setenv: command not found...

 

(2). 有关 server 的 shell,环境变量等简单信息

[shecl@192 ~]$ echo $0
-bash

[shecl@192 ~]$ pwd
/home/shecl

[shecl@192 ~]$ echo $PATH
/opt/pgi/linux86-64/10.6/bin:/usr/lib64/qt-3.3/bin:/usr/lib64/openmpi/bin/:/usr/lib64/mpich/bin/:/opt/pgi/linux86-64/10.6/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/shecl/.local/bin:/home/shecl/bin:/usr/local/MATLAB/R2015b/bin:/usr/local/MATLAB/R2015b/bin/glnxa64

[shecl@192 ~]$ which matlab
alias matlab='/usr/local/MATLAB/R2015b/bin/matlab'
    /usr/local/MATLAB/R2015b/bin/matlab

[shecl@192 ~]$ alias
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'
alias matlab='/usr/local/MATLAB/R2015b/bin/matlab'
alias mpirun='mpirun -x LD_PRELOAD=libmpi.so'
alias ncdump='/opt/netcdf/bin/ncdump'
alias opendir='nautilus'
alias openpdf='xdg-open'
alias vi='vim'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'

 

(3). 以简写命令的方式前台调用 matlab,成功。结果如下:

[shecl@192 ~]$ matlab
MATLAB is selecting SOFTWARE OPENGL rendering.

                            < M A T L A B (R) >
                  Copyright 1984-2015 The MathWorks, Inc.
                   R2015b (8.6.0.267246) 64-bit (glnxa64)
                              August 20, 2015

 
To get started, type one of these: helpwin, helpdesk, or demo.
For product information, visit www.mathworks.com.
 
>> datevec(now)

ans =

   1.0e+03 *

    2.0160    0.0080    0.0150    0.0170    0.0110    0.0030

>> exit

 

(4). 测试用的 matlab 脚本: script.m

[shecl@192 ~]$ cat script.m
disp(['This demo for matlab ',datestr(now,'yyyy-mm-dd HH:MM:SS')]);
disp('Time of 127s pause');
pause(127);
disp(['Time is out on ',datestr(now,'yyyy-mm-dd HH:MM:SS')]);

 

(5). 以绝对路径的方式后台调用 matlab,成功。结果如下:

[shecl@192 ~]$ nohup /usr/local/MATLAB/R2015b/bin/matlab -nojvm -nodisplay -nosplash -nodesktop < script.m 1>running.log 2>running.err &
[1] 41182>> [shecl@192 ~]$ cat running.log

                            < M A T L A B (R) >
                  Copyright 1984-2015 The MathWorks, Inc.
                   R2015b (8.6.0.267246) 64-bit (glnxa64)
                              August 20, 2015

 
For online documentation, see http://www.mathworks.com/support
For product information, visit www.mathworks.com.
 
>> This demo for matlab 2016-08-15 11:37:25
>> Time of 127s pause
>> >> Time is out on 2016-08-15 11:39:32
>> >> [1]+  Done                    nohup /usr/local/MATLAB/R2015b/bin/matlab -nojvm -nodisplay -nosplash -nodesktop < script.m > running.log 2> running.err

 

(6). 以简写命令的方式后台调用 matlab,失败。结果如下:

[shecl@192 ~]$ nohup matlab -nojvm -nodisplay -nosplash -nodesktop < script.m 1>running.log 2>running.err &
[1] 41076
[shecl@192 ~]$ cat running.log

    matlab: No MATLAB bin directory for this machine architecture.

           ARCH = glnxa64

[1]+  Exit 1                  nohup matlab -nojvm -nodisplay -nosplash -nodesktop < script.m > running.log 2> running.err

 

(7). bug 描述

[shecl@192 ~]$ nohup /usr/local/MATLAB/R2015b/bin/matlab -nojvm -nodisplay -nosplash -nodesktop < script.m 1>running.log 2>running.err &   # 调用成功
[shecl@192 ~]$ nohup matlab                              -nojvm -nodisplay -nosplash -nodesktop < script.m 1>running.log 2>running.err &   # 调用失败

 

(8). 修复建议,因权限问题,未解决

可以用创建软链接 (ln -s) 的方式修复这个 bug,但是,没有权限来执行该操作。其原因可能是远程登录时限制了权限,需要在主机上操作;也可能是该用户名未分配该权限,需要切换到超级管理员。为安全起见,不建议使用超级管理员远程登录服务器。

[shecl@192 ~]$ sudo ln -s /usr/local/MATLAB/R2015b/bin/matlab /usr/local/bin/matlab
[sudo] password for shecl: 
Sorry, user shecl is not allowed to execute '/bin/ln -s /usr/local/MATLAB/R2015b/bin/matlab /usr/local/bin/matlab' as root on 192.168.0.45.

 

记录完毕。

 


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Delphi Form显示在第二个显示器中的方法发布时间:2022-07-18
下一篇:
DelphiXE7FMXAndroid输入控件自适应虚拟键盘的位置发布时间:2022-07-18
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap