Search code examples
cronoctave

Syntax for running Octave script by Crontab


A basic Octave test script, check_octave_crontab.m, is

## create some data
cd /path/to/the/required/octave/directory
x = [ 1 2 3 4 5 6 7 8 9 ] ;
dlmwrite( 'crontab_test_file' , x ) ;

and the cronjob is

2,22,42 * * * 1-5 /usr/local/bin/octave '/home/path/to/this/octave/script/check_octave_crontab.m'

but no plot is plotted.

/usr/local/bin/octave is a shared library which points to an octave-5.1.0 shared library, which is my installed version of Octave compiled from source. What do I need to change in the crontab?


Solution

  • This is because there is no DISPLAY in this case. I run my scripts from crontab with

    xvfb-run -e /dev/stdout -a --server-args "-screen 0 1920x1080x24" /usr/local/bin/octave myscript.m