Like crontab R-script and add errors

I am new to Ubuntuand would like to run daily crontab. I am doing a similar job in Windows Command Line, but would like to switch to Ubuntu.

Mine R-Scripthas Error-functionone that prints errors in a separate folder every time the job runs, and an error () has occurred:

 # define error function
 my.error.fun <- function() {
 cat(geterrmessage(), file="/home/network/R/Test.txt", append=TRUE)
} 

# output error
options("error"=my.error.fun)

In crontab -eI defined the following:

00 16 * * * /usr/bin/Rscript /home/R/network/Test.R 2> /home/R/RErrors/Test.txt

but crontabsaved to/tmp/crontab.2t/crontab

where I add errors to R-Script. Unlike Windows Command Linethis concept, it does not seem to work in. UbuntuIt does not seem to work. I am not sure if this is the correct syntax. There RErrorswas no file in the folder .

Can I say some suggestions?

+4
source share

Source: https://habr.com/ru/post/1616088/


All Articles