Set up R cronjob on Centos via crontab on EC2


#1

After searching for quite a while I am still not clear on what is the proper command line to run a cronjob on Centos via crontab on EC2. I want my script to run everyday at 11am.

For test purpose, I created a R file "Test_for_Cron.R" that does this:

x <- 1

y <- 2

z <- x + y

z

My user name is user123, I do not know what is the appropriate path. My R file is located in home folder.

To edit crontab I use

sudo crontab -e
So far, I tried all the following command but it does not work:

0 11 * * * user123 /home/Test_for_Cron.R
0 11 * * * ~/home/user123/scripts/Test_for_Cron.R
0 11 * * * ~/home/R_scripts/Test_for_Cron.R

Can someone please help me understand how to write the correct path ? Thanks !