I had a R script configured to run via cron every day at 10am
library(cronR)
cmd2 = cron_rscript("CargueDiario_RedcapCovid_ODS.R", rscript_log="/home/admonda/R/projects/contagios_covid_santander/log/cargue_diario.log", log_append = T, log_timestamp = T)
cron_add(command = cmd2, frequency = 'daily', at = "10:00" , days_of_week = "*", id = 'FCVREDCAPCOVID_ODS_DIARIO', description = "FCVREDCAPCOVID_ODS_DIARIO")
cron_ls("FCVREDCAPCOVID_ODS_DIARIO")
## cronR job
## id: FCVREDCAPCOVID_ODS_DIARIO
## tags:
## desc: FCVREDCAPCOVID_ODS_DIARIO
0 10 * * 0,1,2,3,4,5,6 /usr/lib/R/bin/Rscript '/home/admonda/R/projects/contagios_covid_santander/CargueDiario_RedcapCovid_ODS.R' >> '/home/admonda/R/projects/contagios_covid_santander/log/cargue_diario.log' 2>&1
Now i need to change it so it runs twice a day (10:00 and 22:00). I have already deleted it from CRON and I would like to make sure this is the correct new command:
cron_add(command = cmd2, frequency = 'daily', at = c("10:00","22:00") , days_of_week = "*", id = 'FCVREDCAPCOVID_ODS_DIARIO', description = "FCVREDCAPCOVID_ODS_DIARIO")
2
Answers
You still can use your original line, just change
10
to10,22
.Or just use cron expression:
source: https://www.rdocumentation.org/packages/cronR/versions/0.4.2/topics/cron_add