Pierre-Julien Cungi
Pierre-Julien Cungi

Reputation: 1

cronR doesn't execute script in Rstudio server

I use a VPS which run a Rstudio server. I'd setup cron and the cronR packages. When I create cron jobs for a Rscript. The cronTab seems to program it, but cron doesn't execute the script.

For example, this simple script which add a date stamp:

dated = data.frame(date = date())
dated2 = read.csv("date.csv",row.names = NULL)
dated = rbind(dated,dated2)
write.csv(dated,"date.csv", row.names = FALSE) 

I create a cron job with cronR and check the crontab:

Listening on http://127.0.0.1:6050
## cronR job
## id:   essai2
## tags: 
## desc: I execute things
0-59 * * * * /usr/lib/R/bin/Rscript '/home/pj/twittAnestProj/verif.R'  >> '/home/pj/twittAnestProj/verif.log' 2>&1

The script never starts (I had no add of date stamp in my scv file...)

Upvotes: 0

Views: 587

Answers (2)

ekoam
ekoam

Reputation: 8844

I encountered this problem before. Usually, it is caused by using a relative path in your read.csv and write.csv functions. Consider changing that data.csv to its full path (something like /home/pj/twittAnestProj/data.csv).

Upvotes: 1

anon
anon

Reputation:

Did you check if the cron daemon is running as in sudo cron start

Upvotes: 0

Related Questions