Code Monkey home page Code Monkey logo

sh-backup's Introduction

sh-backup

Easy backup files and MySQL/PostgreSQL database.

Feature

  • MySQL/PostgreSQL dump
  • Archiving files
  • Upload to FTP

Requirements

  • LFTP
  • Bash
  • MySQL or PostgreSQL
  • Linux or OS X

Configuration

  • ROOT_DIR='Path to file directory'
  • DB_TYPE='Database type (mysql or postgresql)'
  • DB_HOST='localhost or another'
  • DB_PORT='for mysql 3306, for postgresql 5432 or another'
  • DB_PASSWORD='Database password'
  • DB_USERNAME='Database username'
  • DB_NAME='Database name'
  • FTP_SSL - Use or no SSL. By default 'no'.
  • FTP_HOST='FTP IP-address'
  • FTP_LOGIN='FTP login'
  • FTP_PASSWORD='FTP password'
  • FTP_ROOT='Path to directory on FTP'
  • MAX_STORAGE_TIME - Max storage time backups in FTP (Time in seconds. By default 30 days.).

Example:

ROOT_DIR=/Volumes/Home/User/sites/sh-backup
DB_TYPE='mysql'
DB_HOST='localhost'
DB_PORT=3306
DB_PASSWORD='1234'
DB_USERNAME='root'
DB_NAME='sh-backup'
FTP_SSL='no'
FTP_HOST='100.100.100.100'
FTP_LOGIN='ftp_user'
FTP_PASSWORD='ftp_pass'
FTP_ROOT='/'
MAX_STORAGE_TIME=2592000 # 30 days

Usage

  1. Clone or download the sh-backup.
  2. Copy a config file backup.conf.dist to backup.conf.
  3. Configure your the backup.conf file.
  4. Run command:
$ bash backup
Backup...
- Prepare files...
- Prepare database...
- Archiving...
- Uploading to FTP...
- Cleaning tmp...                                 
OK

Notes for PostgreSQL

For correct to work sh-backup you must have md5 or password auth-method in pg_hba.conf for your a database.

For authentication uses .pgpass file. If one not exists will try the file create.

License

sh-backup is released under the BSD 3-Clause License.

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.