Giter Site home page Giter Site logo

backup-db's Introduction

Script de sauvegarde des bases de donnée

Installation

Se connecter en ssh au user

cd /home/user
git clone [email protected]:Magicalex/backup-db.git backup
cd backup
touch config.sh

Configuration

Configuration des identifiants mysql

Paramètres de connexion à la base mysql local configurer son fichier ~/.mylogin.cnf

mysql_config_editor set --login-path=user_backup --host=127.0.0.1 --user=root --password

Commande utile :

mysql_config_editor print --all // affiche tout
mysql_config_editor remove --login-path=user_backup // supprime le login user_backup
mysql_config_editor reset // remettre à zéro le fichier

Configuration du fichier config.sh

# vim ~/backup/config.sh

#!/usr/bin/env bash
## fichier config.sh

bdd_login="user_backup"
site="domain.tld"

## Indique les noms des db à sauvegarder dans un tableau
bdd_name=(blog postfix wordpress)

## Dossier de sauvegarde et temps en jour de conservation des sauvegardes
backup_folder="archive-db"
remote_folder="/backup-folder"
keep_backup="15"

## Parametres de connexion au serveur ftp.
# c'est mon ftp perso
ftp_host="backup.domain.tld"
ftp_user="user"
ftp_passwd="password"
cd ~/backup
chmod +x config.sh save_db.sh

Exemple de configuration de la crontab

# crontab -e

00 01 * * * /home/user/backup/save_db.sh > /dev/null 2>&1

backup-db's People

Contributors

magicalex avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.