Cron jobs
What are cron jobs
Cron jobs are a way to launch periodically an app. This is useful to launch R or Python scripts doing calculation before shutting off themselves. The Cron jobs section of the app details page will list cron jobs:
You can create, edit or delete cron jobs from this section. Cron jobs have some settings:
Choose a name, a status (active or inactive), and an interval:
- Hourly will start the app each hour at a specific minute;
- Daily will start the app each day at a specific hour;
- Weekly will start the app each week on a specific day and time.
You can add several cron jobs for a same app.
Stopping an app
Danger
Please read this carefuly before creating your first cron job.
When an app is launched by a cron job, you have to stop the app from itself:
- R and Shiny apps or scripts can be stopped with
q()
; - Python and Dash apps or scripts can be stopped with
sys.exit(0)
; - RPGM apps can be stopped with
rpgm.quit()
.
If you don't stop/exit an app, R/Python will continue to run indefinitely. For example, running a hourly app for 10 hours would result in 10 instances running in the background and consuming the server CPU and RAM.