Back to Cron Helper
Recipedatabasemongodbbackupnosql
Automate MongoDB Backups Daily
How to schedule a daily MongoDB backup using cron.This task uses `mongodump` to create a binary export of your MongoDB database. It creates a new directory for each day based on the date. Regular binary backups are essential for disaster recovery in NoSQL environments.
Cron Schedule
Every Day at Midnight
Runs once per day at 00:00 (midnight).0 0 * * *Command to Run
Copy and paste this command into your crontab or automation script
mongodump --out /var/backups/mongo/$(date +%Y%m%d)Implementation Examples
Unix/Linux Crontab
0 0 * * * /path/to/script.sh
Python (with schedule library)
schedule.every().day.at("00:00").do(job)Node.js (with node-cron)
cron.schedule('0 0 * * *', () => {
console.log('Running daily at midnight');
});Go (with robfig/cron)
c.AddFunc("0 0 * * *", func() { fmt.Println("Run daily at midnight") })GitHub Actions Workflow
- cron: "0 0 * * *"
Related Cron Recipes
Automate PostgreSQL Backups Daily
databasepostgresbackup
Automate MySQL Backups Daily
databasemysqlbackup
Automate Redis RDB Snapshots
databaserediscache
PostgreSQL Vacuum Analyze
databasepostgresmaintenance
Rsync Incremental Backup
linuxbackupnetwork