Trying to run an 'R' script at 00:30 every day. The script is located in /home/username/Desktop/folder/runnow.r and which Rscript
reveals that the absolute path to binary Rscript is /usr/bin/Rscript
. The crontab entry that I made was using the crontab -e
command and then inserting the line:
38 14 * * * /usr/bin/Rscript /home/username/Desktop/folder/runnow.r
Time right now is 14:36 of course. And I wait 5 minutes to see if a CSV file is created in my home folder. Since the R script runnow.r has instructions to process some data and then create a CSV file in the home folder.
But there's no CSV file in my home folder. When I manually run this script (without using cron), it does create a CSV in my home folder. So I know there's nothing wrong with the script. I am using absolute paths everywhere and I have even tried restarting the crond using service crond restart
. However, no luck. Is this a privileges issue? Does crond not have enough privileges to create a CSV in my own home folder?
EDIT: NEW OBSERVATION
If I change the line to * * * * * /usr/bin/Rscript /home/username/Desktop/foldername/runme.r
instead of specifying the exact time, it does create the right CSV file in the right location. So * * * * *
works and 54 13 * * *
doesn't. Why?