I have the following shell script:

matlab -nodisplay -nosplash -nodesktop -r "run('/home/username/test.m');exit;"

The test.m script is a matlab script that plots a graph and saves the figure as pdf without making the figure visible. Below is the content of the test.m script:

   % This is a matlab script to test with *at* execution. 
   t1=[1 2 3];
   t2=[1 2 3];

What I want to do is to schedule the shell script to run at certain time. Therefore I am using the "at" command as follows:

echo "run_matlab_script.sh" | at 15:00 

But when the time is 15:00 , the script seems to not be executed. I have also tried including the path to my script, but don't get "at" to work.

I have been following the instructions in this link as well:


Am I using "at" the correct way? Is there an alternative to schedule the execution of a script. When I do source run_matlab_script.sh the script runs without issues.

For the shell script I gave it permissions with:

chmod +x run_matlab_script.sh


  • Is run_matlab_script.sh located on your PATH? can you execute it outside of at without prepending a relative or absolute location? – steeldriver Oct 15 '19 at 2:34
  • The run_matlab_script.sh is in my home directory; it runs without issues when I do: source run_matlab_script.sh (within my home directory). I am not entirely well versed in linux, I am still learning, so I apologize for any confusion in advanced. – dareToDiffer07 Oct 15 '19 at 2:48

Your Answer

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

Browse other questions tagged or ask your own question.