Thanks to visit codestin.com
Credit goes to github.com

Skip to content

evgeniy-klemin/tar-smart-backup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tar-smart-backup

Install

Dependencies

  1. Python 3

    Example install on ubuntu 14.04 through virtualenv:

    virtualenv-3.4 venv
    . venv/bin/activate
  2. On ubuntu 14.04 package build-essential for paramiko:

    sudo apt-get install build-essential

Install tar-smart-backup

git clone https://github.com/evgeniy-klemin/tar-smart-backup
cd tar-smart-backup
pip install -r requirements.txt

Examples

Backup

Make backup named "mybackup":

python tar_smart_backup.py "mybackup" backup /var/www/media --dst=/var/backups

Backup with syncing to remote server [email protected]:/backup:

SYNC_OPTS="--sync --ssh-user=backup --ssh-key-rsa=/home/user/some_id_rsa --ssh-host=backup.internal --remote-dir=/backups"
python tar_smart_backup.py $SYNC_OPTS "mybackup" backup /var/www/media --dst=/var/backups

Restore

Restore backup named "mybackup" stored in /var/backups to /var/www/media:

python tar_smart_backup.py "mybackup" restore /var/www/media --src=/var/backups

Restore backup named "mybackup" from remote backup server [email protected]:/backup to /var/www/media, where /var/backups temp folder:

SYNC_OPTS="--sync --ssh-user=backup --ssh-key-rsa=/home/user/some_id_rsa --ssh-host=backup.internal --remote-dir=/backups"
python tar_smart_backup.py $SYNC_OPTS "mybackup" backup /var/www/media --dst=/var/backups

Options

Backup options

--count - How much backups make in each level(depth)

--levels - How much tar LEVEL-1 depth create

With --levels=3 --count=3 (five times calls):

python tar_smart_backup.py "mybackup" backup /var/www/media --dst=/var/backups --levels=3 --count=3
  • mybackup.tar.gz - tar LEVEL-0
  • mybackup_01.tar.gz - tar LEVEL-1 depth=1
  • mybackup_01_01.tar.gz - tar LEVEL-1 depth=2
  • mybackup_01_02.tar.gz - tar LEVEL-1 depth=2
  • mybackup_01_03.tar.gz - tar LEVEL-1 depth=2

In next backup call:

  • mybackup.tar.gz - tar LEVEL-0
  • mybackup_01.tar.gz - tar LEVEL-1 depth=1
  • mybackup_02.tar.gz - tar LEVEL-1 depth=1

In next backup call:

  • mybackup.tar.gz - tar LEVEL-0
  • mybackup_01.tar.gz - tar LEVEL-1 depth=1
  • mybackup_02.tar.gz - tar LEVEL-1 depth=1
  • mybackup_02_01.tar.gz - tar LEVEL-1 depth=2

About

Backup directory by incremental tar

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published