4 months ago
Hi. I have a usecase for a client where I need to schedule the backup of MongoDB and Cloudflare R2.
My thought process:
Create a NodeJS app with
node-cron
&shelljs
(to run UNIX commands) installed.Write necessary shell commands in cron.schedule e.g.:
shell.exec('command to backup mongo...')
shell.exec('command to backup r2...')
Dockerize with a Dockerfile that installs the necessary CLI tools to backup MongoDB (
MongoDB CLI DB Tools
) and R2 (rclone
).
I can run the container and it'll work, sure. But I only need to run the shell commands once a day.
Leaving the container to run 24/7 doesn't seem ideal.
Is there anyway I can schedule the container to startup and stop daily?
1 Replies
4 months ago
Hello,
Ditch node-cron and use our native CRON scheduler!