I am using cronr add in with RStudio (on Mac OSX 10.11.6 El Capitain) to schedule my script fetch_n_write.R.
If I select 'Once' from the Schedule
options in the pop up, the script is run immediately and the file it generates is outputted. Success!
If I try to schedule the job to run daily in 2 minutes, the log shows it running the code but then ends with '/bin/sh: Rscript: command not found' and the file does not get written. No Success.
I am guessing after some searching that this has to do something with permissions. It was suggestedthat R might need to be reinstalled, but which R
results in/usr/local/bin/R
and which Rscript
results in
/usr/local/bin/Rscript
which I think means I should not have to reinstall R?
The problem is in the cron
command, and the job fails because the absolute path is not used for the actual command portion (returning the error '/bin/sh: Rscript: command not found'
):
19 21 * * * Rscript /Users/ ...
cron
does not know where to find Rscript
, so you must specify:
19 21 * * * /usr/local/bin/Rscript /Users/ ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With