ibrahimsayar / linux-mongodb-aws-backup-script

A simple Bash script automating MongoDB backup and upload to AWS S3.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

linux-mongodb-aws-backup-script

A simple Bash script automating MongoDB backup and upload to AWS S3.

Requirements

  • Linux

Before Install

Variables that need to be changed

add-backup-time-to-crontab.sh

# The root user may vary on your server, so you may need to write your own user in the 'root' section.
# You can find out which user you are with the 'whoami' command.
# Before
CRONTAB_FILE="/var/spool/cron/crontabs/root"
# After
CRONTAB_FILE="/var/spool/cron/crontabs/ubuntu"

# The script is defined to run at 5 am. If you want to change it, you must make your definition.
# Before
WORKING_TIME="0 5 * * *"

# After (Every Minutes)
WORKING_TIME="* * * * *"

mongodb-aws-backup-script.sh

# You must define mongodb username, password and database information in this section.
export MONGODB_USERNAME=mongodbDatabaseUser
export MONGODB_PASSWORD=mongodbDatabasePassword
export MONGODB_DATABASE=mongodbDatabase

# You must define aws bucket name
export S3_BUCKET_NAME=s3://bucket-name

Install

# Go directory
cd /home

# Clone repository
git clone https://github.com/ibrahimsayar/linux-mongodb-aws-backup-script.git

# Go script directory
cd linux-mongodb-aws-backup-script

# If you have completed the steps and variables required 'Before Install' installation, you can run it.
# Run crontab command
bash add-backup-time-to-crontab.sh

# Congratulations, that's all you need to do

What you need to know before installing the script

About

A simple Bash script automating MongoDB backup and upload to AWS S3.

License:MIT License


Languages

Language:Shell 100.0%