Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/quagliato/backup-with-shell

Backup full directories, MySQL and MongoDB databases to tar.gz files and send it to AWS S3 and Digital Ocean Spaces.
https://github.com/quagliato/backup-with-shell

aws aws-s3 linux mongodb mysql shell

Last synced: 8 days ago
JSON representation

Backup full directories, MySQL and MongoDB databases to tar.gz files and send it to AWS S3 and Digital Ocean Spaces.

Awesome Lists containing this project

README

        

# backup-with-shell

This repository have some examples of shell scripts that create compressed
backups of directories, MySQL and MongoDB databases.

It also contains scripts to send this backup files to AWS S3 and Digital Ocean
Spaces.

These are the scripts:

* `dir_bkp.sh`: copy from an specific directory
* `mongo_bkp.sh`: backup from an MongoDB databases
* `mongo_bkp_uri.sh`: same from above, but using the URI as a single parameter
* `mongo_bkp_uri_ssl.sh`: same from above, but with ssl
* `mysql-all_dbs-bkp.sh`: backup from MySQL databases
* `mysql-all_dbs-bkp-git.sh`: backup from MySQL databases and stores it in a
git repo
* `send_s3.sh`: send the files to an AWS S3 bucket
* `send_do_spaces.sh`: send the files to a Digital Ocean Space

All scripts receive almost all settings by parameters. I'll list some examples.

## Execution

### dir\_bkp.sh

```
./dir_bkp.sh
```

* BASENAME: the basename of the file which will be used in the final filename
* SOURCE\_DIR: the directory from which the backup will be created
* STASH\_DIR: the directory where the backup will be placed
* WORK\_DIR: the directory where the process will be executed

### mongo\_bkp.sh

```
./mongo_bkp.sh
```

* BASENAME: the basename of the file which will be used in the final filename
* MONGODB\_HOST: the address of the MongoDB Server
* MONGODB\_PORT: the port of the MongoDB Server
* MONGODB\_USER: the user to access MongoDB Server
* MONGODB\_PASS: the password to acess MongoDB Server
* MONGODB\_AUTH\_DB: the database which will be used to authenticate
* STASH\_DIR: the directory where the backup will be placed
* WORK\_DIR: the directory where the process will be executed

### mongo\_bkp\_uri.sh

```
./mongo_bkp_uri.sh
```

* BASENAME: the basename of the file which will be used in the final filename
* MONGODB\_URI: the complete URI to connect to a MongoDB Server
* STASH\_DIR: the directory where the backup will be placed
* WORK\_DIR: the directory where the process will be executed

### mongo\_bkp\_uri\_ssl.sh

```
./mongo_bkp_uri_ssl.sh
```

* BASENAME: the basename of the file which will be used in the final filename
* MONGODB\_URI: the complete URI to connect to a MongoDB Server
* STASH\_DIR: the directory where the backup will be placed
* WORK\_DIR: the directory where the process will be executed

### mysql-all\_dbs-bkp.sh

```
./mysql-all_dbs-bkp.sh
```

* BASENAME: the basename of the file which will be used in the final filename
* DB\_HOST: the address of the MySQL Server
* DB\_USER: the user to access MySQL Server
* DB\_PASS: the password to acess MySQL Server
* STASH\_DIR: the directory where the backup will be placed
* WORK\_DIR: the directory where the process will be executed

### mysql-all\_dbs-bkp-git.sh

```
./mysql-all_dbs-bkp.sh
```

* BASENAME: the basename of the file which will be used in the final filename
* DB\_HOST: the address of the MySQL Server
* DB\_USER: the user to access MySQL Server
* DB\_PASS: the password to acess MySQL Server
* GIT\_DIR: the git directory where the backup will be placed

### send\_s3.sh

```
./send_s3.sh
```

* STASH\_DIR: the directory where the stash files are
* UPLOADED\_DIR: the directory where the files will be moved after upload
* AWS\_BUCKET: the AWS S3 bucket name
* AWS\_REGION: the AWS Region where the AWS S3 Bucket is located
* S3KEY: the AWS S3 Key
* S3SECRET: the AWS S3 Secret

### send\_do\_spaces.sh

```
./send_do_spaces.sh
```

* STASH\_DIR: the directory where the stash files are
* UPLOADED\_DIR: the directory where the files will be moved after upload
* SPACE\_NAME: the Digital Ocean Space name
* DO\_REGION: the Digital Ocean region where the Space is located
* AUTH\_KEY: the auth key
* AUTH\_SECRET: the auth secret

## Get in touch

[[email protected]](mailto:[email protected])