How to export graphics to SVG in script executed through cron?
I can somewhat reproduce this error. Except for me, if I try to export a graphic with no display set, the kernel just hangs. The answer is to use an Xvfb display server, as described here.
I have the file, exportSVG.m
, with the contents
plot = Plot[x, {x, -3, 3}];
Export["/home/jasonb/some.svg", plot];
Then another file, exportSVG.sh
,
#!/usr/bin/env bash
xvfb-run /usr/local/bin/wolframscript -script /home/jasonb/exportSVG.m
If I add this to my crontab
with out the xvfb-run
, it hangs. If I add in that command, it works. You'll need to ensure you have it installed, check via which xvfb-run
.