The following is my very simple Rscript called test.R
that I want to run every minute
print("Hello, World!")
and I would like to automate this script in the hopes that I can do the same for future scripts. I use the crontab -e
call and add the following:
* * * * * Rscript home/<username>/test.R
which fails to produce any results.
Per the examples of cron job to execute r script not working and Schedule a Rscript crontab everyminute, I have made the following variations in the crontab code
* * * * * Rscript "home/<username>/test.R"
* * * * * usr/bin/Rscript home/<username>/test.R
* * * * * usr/bin/Rscript "home/<username>/test.R"
* * * * * cd home/<username>/ && Rscript test.R
* * * * * cd home/<username>/ && usr/bin/Rscript test.R
all of which do nothing. I have also created a script called myScript.sh
which contains Rscript /home/<username>/test.R
, and tried assigning the task * * * * * home/<username>/myScript.sh
all to no avail.
I have made sure to run chmod +x
to make my files executable beforehand, and simply typing Rscript test.R
produces my desired results.
What else can I do to make this work? Is there some issue with me running Ubuntu Server 18.04 vs running the desktop version?
Update
I have run all the above variations, with a /
before home
and usr
. I have also switched to trying ~/test.R
but I still get no results.