1. 问题描述
一段数据处理的 shell 程序,在 shell 中手动运行,可以正确执行。但是,把它放在 crontab 列表里,就会报错,提示 "matlab: command not found."。
AutoRefreshData.sh 的部分内容如下:
[She@She ~]$ cat /home/She/data/AutoRefreshData.sh #!/bin/bash ... MatlabFile='/mnt/L/Data/main4mat.m' chmod +x ${MatlabFile} matlab -nodesktop -nosplash -nojvm < ${MatlabFile} 1>running.log 2>running.err &
在终端下,AutoRefreshData.sh 可正确执行:
@H_403_34@[She@She ~]$ /home/She/data/AutoRefreshData.sh [She@She ~]$ 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. >> >> >> >> >> >> >> /mnt/L/Data/matFile/jpl16228.mat >>
[She@She ~]$ cat ~/running.err
[She@She ~]$