I am using linux and Rstudio-server. I have R code that renders a quarto document using quarto_render. It works fine when I run it interactively, but when I set up a cron job to run the R script I get the error message Error in find_quarto() : Unable to find quarto command line tools..
I guess the problem is with my path, but I don't know how to fix it. The quarto-cli tool is installed in /home/roger/quarto-cli/package/dist/bin and that path shows up when I do echo $PATH and when I run quarto check everything seems to be okay (all checks pass).
It’s been a terribly long time since I’ve run a cron job (actually, pre-Linux), but a faint bell in my mind makes me wonder if maybe cron is running its jobs either as a different user or, perhaps more likely, in a different shell, with only default $PATH set.
RScript, which is usually what you use to execute an R script with cron, doesn't load the same environment variables as your RStudio session, one possible solution is to set them yourself at the start of your code, in this case you would need to set QUARTO_PATH, for example: