1

在 shinyapp.io 上部署后,Cron 作业无法正常工作

我们正在尝试通过 cronR 在我们的 shinyapp 中安排一些作业,它正在本地系统上运行,但是当我们在 shinyapp.io 服务器上部署它时不会立即显示以下错误。

An error has occurred
The application failed to start (exited with code 1).


Attaching package: ‘DT’

The following objects are masked from ‘package:shiny’:

    dataTableOutput, renderDataTable

Adding cronjob:
---------------

# cronR job
# id:   temp_data_fetch
# tags: lab, xyz
# desc: temp Data Loading
0-59 * * * * /opt/R/3.5.3/lib/R/bin/Rscript '/srv/connect/apps/Temp/ETL.R'  >> '/srv/connect/apps/Temp/ETL.log' 2>&1
Error in value[[3L]](cond) : error in running command
Calls: local ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Execution halted

        #Cron Script
        if(!(file.exists("/srv/connect/apps/Temp/scripts_scheduled.rds"))){
            cmd <- cronR::cron_rscript(rscript = '/srv/connect/apps/Temp/ETL.R')
            cronR::cron_add(cmd, frequency = 'minutely', id = 'temp_data_fetch',description = 'temp Data Loading',tags = c('lab', 'xyz'))
            TEXT<-"temp_data_fetch"
            saveRDS(TEXT,"/srv/connect/apps/Temp/scripts_scheduled.rds")
        }

        #ETL.R 

        trigger_time <- readRDS(file = "/srv/connect/apps/Temp/trigger_time.rds")
        trigger_time <- c(trigger_time,paste(Sys.time()))
        saveRDS(trigger_time,file = "/srv/connect/apps/Temp/trigger_time.rds")
4

0 回答 0