1

I want to schedule an R script to run regularly. The most obvious attempt I found when googling is using the cronR package and the RStudio Add-In that comes with it.

After creating a dummy script containing only cat("Hello World") I opened the Add-In and created the job. When trying to start the job I ended up with the error message

crontab: tmp/tmp.X: Operation not permitted

This led me to the question here. I granted Terminal and cron full Disk access. The problem remained.


Edit after comment by @Maylo:

I tried adding the job manually using crontab -e. The line I added was:

0 * * * * /usr/bin/Rscript /Users/me/Documents/R/test.R

After quitting crontab -e with :wq I got the following message on my terminal:

crontab: no crontab for me - using an empty one
crontab: installing new crontab
crontab: tmp/tmp.37904: Operation not permitted
crontab: edits left in /tmp/crontab.Jw9DPv2aBd

What else may cause this error message / problem?

Are there any other solutions to run a script regularly? (say every hour)

Thanks in advance for any help!

symbolrush
  • 7,123
  • 1
  • 39
  • 67
  • how about just adding the cronjob directly? does this still give you trouble? For example `0 * * * * /usr/bin/Rscript /path/to/your/R/script` or wherever Rscript is installed on mac? Add the aforementioned line to `crontab -e` – Maylo Aug 19 '20 at 08:32
  • @Maylo: Thx for your comment. I added this line and ended up with the same error message. Any ideas? – symbolrush Aug 19 '20 at 09:56
  • Why don't you use batch scripts? – Christoph Aug 24 '20 at 06:52
  • @Christoph What do you mean by 'batch scripts'? Can you make an example? – symbolrush Aug 24 '20 at 10:35
  • See [here](https://stackoverflow.com/q/18306362/5784831) or [here](https://stackoverflow.com/q/750786/5784831). I don't use MACOS... – Christoph Aug 24 '20 at 13:59
  • @Christoph That's what I do. The part that does not work is not running the script, but scheduling it.. Thx anyway – symbolrush Aug 24 '20 at 14:40
  • I'm having the same issue as described in the part two. Maybe it started after a `brew update`, but that might be unrelated. Did you figure it out by chance? – luckydonald Oct 21 '21 at 15:20

0 Answers0