backupy

Írtam magamnak egy saját mentőalkalmazást - részben gyakorlásból, részben nem találtam olyat, ami pont megfelel nekem. Tudom, C/C++-ben gyorsabb lenne, de nekem most ehhez volt kedvem :)

A jó benne, hogy 1 db python file, python 3.4 kell neki, más nem. Én már ezzel intézem az ütemezett mentéseimet. Ami volt, annak az include/exclude képességei nem voltak megfelelőek számomra.

Website
https://github.com/kaktusztea/backupy

Features

  • Archive target files (tar, targz, tarbz2, zip)
  • Minden backup set-et 1 dedikált .cfg file reprezentál
  • Backup task-ok a Backup set-ek alatt vannak deklarálva
  • include/exclude global (backup set)
  • include/exclude task level (backup task)
  • follow symlink settings
  • md5 creation to csv

Clone repo
git clone https://kaktusztea@bitbucket.org/kaktusztea/backupy.git

Create init backup set config file (first run)
./backupy.py

Help
./backupy.py --manual
./backupy.py --help

Edit default config (default backup set)
vi /home/$USER/.config/backupy/default.cfg

Usage with default.cfg backup set
./backupy.py

Usage with multiple backup sets
./backupy.py -s /home/foo/backupysets/01.cfg /home/foo/backupysets/02.cfg /home/foo/backupysets/03.cfg

Validate backup set config files
./backupy.py --validate -s /home/foo/backupysets/01.cfg /home/foo/backupysets/02.cfg /home/foo/backupysets/03.cfg

Debug mode
./backupy.py --debug
(useful if you want to see skipped files, broken symlink handling, etc)

Hozzászólások

Egy kicsit a big picturet bemutatnád? Forrásmappákat tar.gz -z be és átmásolja egy y lokációra, vagy mi a lényeg? (owncloudot használok)

--
debian,libreelec,openmediavault,ubuntu,windows,arch,lineageOS
zbook/elitebook/rpi3/nexus5_hammerhead

Persze. A lényeg, hogy egy backup set alatt (amit 1 config file reprezentál) több backup task van.
A lenti config részleten látszik a [BACKUP1] nevű backup task.

Agyon lehet cizellálni paraméterekkel, de a lényeg az hogy egy backup task egy db archív file-t hoz létre (tetszés szerint tar, targz, tarbz2, zip).
Nem másol, hanem direktben a 'path_result_dir' számára megadott helyre készíti el az 'archive_name' nevű file-t (a dátum és idő hozzáfűzésével).
Hogy mi kerül bele az archívba, azt az 'include_dirX' sorok adják meg, ahol definiálod a könyvtárakat full path-al, amiket betömörít.

A tömörítés natív python hívásokkal történik, tehát nem hív ki oprendszerbe. OSX alatt is működik, teszteltem. Windows-al még nem próbáltam, de ki fogom.

Idemásolom a './backup.py --manual' kimenetét:


Summary:
   - backupy handles backup sets - represented by .cfg files
   - every backups set is built up from backup tasks [BACKUPx] sections below
   - you can enable/disable backup sets and backups tasks below them by 'enabled' parameter in config file 

Example for config file
   [META]
   name = My backup set                 # name of the backup set represented by this config file
   description = For relaxed days :)    # Free text about this backup set, its purpose, etc.
   enabled = yes                        # is this backup set enabled (or skipped)

   [GLOBAL_EXCLUDES]                    # excludes that apply to all [BACKUPx] tasks
                                          you can change options' values, but don't modify section name and option names!
   exclude_files = Thumbs.db, temp.txt  # list of globally excluded filenames
   exclude_endings = ~, swp             # list of globally excluded file extension types
   exclude_dir_names = trash, garbage   # list of globally excluded directory names without path

   [BACKUP1]                            # Mandatory name pattern: BACKUP[1-99] (99 max) ; don't write anything after the number
  *name = My Document backup            # write backup task name here
  *enabled = yes                        # is this backup active. {yes, no}
  *create_target_date_dir = yes         # Creates subdir in target dir from date in format: YYYY-MM-DD
  *archive_name = document_backup       # archive file name without extension
  *path_result_dir = /home/joe/backup   # Where to create the archive file
  *method = targz                       # Compression method {tar, targz, tarbz2, zip}
  *followsym = yes                      # Should compressor follow symlinks
  *withpath = no                        # compress files with or without full path
  *skip_if_permission_fail = no         # skips backup task if there is/are file(s) with no access by running user
  *skip_if_directory_nonexistent = no   # skips backup task if there is/are non-existent include_dir
  *include_dir1 = /home/joe/humour      # included directory 1. (at least one is mandatory)
   include_dir2 = /home/joe/novels      # included directory 2.
   inlcude_dirN = ... 
   ... 
   exclude_dir_names = garbage, temp    # list of excluded directory names without path
   exclude_dir_fullpath1 = /home/joe/humour/saskabare   # exclude directory 1. Not mandatory.
   exclude_dir_fullpath2 = /home/joe/novels/bad_ones
   exclude_dir_fullpathN = ...
   ...
   exclude_endings = ~, gif, jpg, bak   # list of excluded file extension types
   exclude_files = abc.log, Thumbs.db   # list of excluded filenames


   [BACKUP2]
   ...

   * Mandatory options

Tip 1: Don't forget to set 'enabled' to 'yes' if you want a backup set or task to be active!
Tip 2: use of comment sign '#' is allowed - at the end of option lines
Tip 3: 'exclude_endings' special case: '~'  It excludes file endings like 'myfile.doc~'  (NOT myfile.~) 
Tip 4: 'exclude_dir_names' are active only _below_ the included directory's root path

Jópofa cucc!
A hosszúkígyónyelves kivitelezés miatt meg ne parázz - ha én vetemedtem volna rá, hogy ilyet csináljak lehet nodejs-ben készült volna.... :)

Ilyen célokra esetleg még szóba jöhet az rsync --backup --backup-dir=... kapcsolókkal.
Ennek előnye, hogy differenciát húz át a csatornán.

Nem tudom, hogy kötekedés, feltételes bug report vagy csak felesleges billentyűzetkoptatás, de csak megkérdezem: a mentett fájlok összes attribútumát megőrzi a program és vissza is lehet tölteni azokat?
Gondolok itt ACL-ekre, capability beállításokra binárisok esetében stb.