项目作者: laurence6

项目描述 :
A rsync-based backup script written in Python.
高级语言: Python
项目地址: git://github.com/laurence6/backup.py.git
创建时间: 2016-10-08T05:05:31Z
项目社区:https://github.com/laurence6/backup.py

开源协议:GNU General Public License v3.0

下载


backup.py

A backup script written in Python3.

A simple encapsulation of Rsync.

Requirements

  • Python3
  • Rsync
  • Bash

Usage

  1. Usage: backup.py [OPTIONS...] CONFIG_FILE [ADDITIONAL_RSYNC_OPTIONS...]
  2. OPTIONS:
  3. -q, --quiet keep quiet
  4. -v, --verbose increase verbosity
  5. -n, --show-cmd print rsync command and exit
  6. -h, --help print this help list and exit
  7. -V, --version print program version and exit
  8. Default rsync options: --verbose --human-readable --archive --hard-links --acls --xattrs --numeric-ids --delete

Configuration

  • enabled (Required)
  • src_dir (Required)
  • dst_dir (Required)
  • include (Optional)
  • exclude (Optional)
  • options (Optional)
  • options_mode (Optional)

Example

Example configuration file

  1. CONFIG_ROOT = {
  2. 'enabled': True, # Required. Set True to enable this config block.
  3. 'src_dir': '/', # Required. Source directory.
  4. 'dst_dir': '/mnt/Backup/root', # Required. Destination directory.
  5. 'include': [
  6. '/home/user/',
  7. ], # Optional. Include these files.
  8. 'exclude': [
  9. 'lost+found',
  10. '/dev/*',
  11. '/proc/*',
  12. '/sys/*',
  13. '/tmp/*',
  14. '/run/*',
  15. '/mnt/*',
  16. '/media/*',
  17. '/var/tmp/*',
  18. '/home/*',
  19. ], # Optional. Exclude these files.
  20. 'options_mode': '', # Optional. 'append' (default): append options to the default rsync options, 'override': set rsync options to options.
  21. 'options': [
  22. '--log-file=/mnt/root-log',
  23. ], # Optional. Rsync options.
  24. }
  25. CONFIG_HOME = {
  26. 'enabled': True,
  27. 'src_dir': '/home/',
  28. 'dst_dir': '/mnt/Backup/home',
  29. }

Command:

  1. $ backup.py config.py

License

Copyright (C) 2014-2020 Laurence Liu liuxy6@gmail.com

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses.