Schedule task on a shiny application [duplicate]

2020-03-17 04:20发布

I am working on an application using shiny, as part of my project I need to scrape some data from a website on a daily basis.
Is it possible to schedule a job to be done every 12 hours, using cron or a similar utility?
I am using the free shiny server hosting server

2条回答
【Aperson】
2楼-- · 2020-03-17 04:55

I really don't recommend doing this in shiny. Yes, invalidateLater is meant to schedule a reactive to be run again later , but your usecase is abusing that function. Also, a single shiny app session is not meant to be running 24/7, it will likely die between those 12 hours.

You should probably use a cronjob (the cronjob can call an R script, that's 100% legitimate)

查看更多
小情绪 Triste *
3楼-- · 2020-03-17 05:08

There is a specific method within Shiny doind exactly that:

invalidateLater

See also http://shiny.rstudio.com/reference/shiny/latest/invalidateLater.html.

查看更多
登录 后发表回答