Skip to content

Latest commit

 

History

History
30 lines (24 loc) · 1.45 KB

README.md

File metadata and controls

30 lines (24 loc) · 1.45 KB

Mongo Backup Script

A Lightweight shell script designed to automate the backup process of MongoDB databases and send the backup files via email. This script ensures that your database backups are created securely and efficiently, with an easy-to-follow setup and execution process.

Mongo-Backup-Service

Features

  • Automated Backups: Schedule backups to run automatically at specified intervals using cron jobs.
  • Compression: Creates a compressed ZIP file of the backup directory with optional password protection.
  • Email Notifications: Sends the backup file as an email attachment to a specified email address.
  • Customizable Settings: Easily configure MongoDB connection details, email SMTP settings, and backup directory paths.
  • Log Generation: Generates logs of the backup operation for easy monitoring and troubleshooting.

Pre-Requists

Make sure to:

  • Name this file mongobackup.sh and place it in /home/$userdir
  • Run sudo apt-get install sendemail to install the sendemail for sending the backup file through email
  • Fill in DB host, name, port number, user and password
  • Run chmod +x mongobackup.sh
  • Test it out via ./mongobackup.sh
  • Set up a monthly backup via crontab -e: ? 0 0 1 * * /home/ubuntu/mongobackup.sh > /home/ubuntu/backup.log