{"id":16793668,"url":"https://github.com/bartkl/backup","last_synced_at":"2025-03-17T02:24:06.459Z","repository":{"id":46011970,"uuid":"302612228","full_name":"bartkl/backup","owner":"bartkl","description":"Backup tool which wraps rsync.","archived":false,"fork":false,"pushed_at":"2021-11-20T12:50:30.000Z","size":19,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-23T12:15:17.452Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bartkl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-10-09T10:46:57.000Z","updated_at":"2021-11-20T12:47:50.000Z","dependencies_parsed_at":"2022-07-20T06:13:48.968Z","dependency_job_id":null,"html_url":"https://github.com/bartkl/backup","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bartkl%2Fbackup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bartkl%2Fbackup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bartkl%2Fbackup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bartkl%2Fbackup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bartkl","download_url":"https://codeload.github.com/bartkl/backup/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243960636,"owners_count":20375107,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T08:49:55.517Z","updated_at":"2025-03-17T02:24:06.439Z","avatar_url":"https://github.com/bartkl.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `backup`\nThis is my personal backup tool on top of Rsync.\n\nWhat it does for me:\n* Configure different rsync calls in a human readable fashion through the `config.ini` file.\n* Maintain the base parameters I wish to include for all rsync calls in a central place (the `rsync` section).\n* It let's me define config blocks for each rsync call (module), in which I supply the local path and specific parameters. The path can make use of a shared base path you can set in the `rsync` config block.\n* Using the `transfer direction` option, I can configure per module whether I wish to pull from the host, or push to it.\n* It can easily be configured to log to file, but I have it configured to log to stdout when run manually, and to `journald` otherwise (see _Scheduling with journal logging_).\n    - To make it log to file, simply provide a base option `--log-file \u003cFILEPATH\u003e` in the `rsync` section.\n* When backing up manually, it allows intuitive usage by simply stating the module name(s) you wish to back up, and that's it.\n* Transparant, readable code, as opposed to shell scripts which quickly turn ugly and less robust.\n\n## Installation\nCurrently, I haven't released this on PyPi and I don't know if I'm going to.\n\n### Install\nFor now, I just install directly from the source code:\n\n```shell\n# pip3 install git+https://github.com/bartkl/backup.git#egg=Backup\n```\n\n### Uninstall\nTo uninstall, simply use pip again:\n\n```shell\n# pip3 uninstall backup\n```\n\n## Configuration\nThe script will look for a `config.ini` file as follows:\n\n* If the environment variable `$BACKUP_CONFIG_DIR` is defined, it looks there.\n* Otherwise, it looks for that file in `~/.config/backup`.\n\nThe config file contains:\n\n* A mandatory `rsync` section.\n  Here global Rsync related options can be defined.\n\n  Fields:\n  - `host`: The Rsync daemon host to backup to _(Required)_.\n  - `base opts`: Whitespace separated string of Rsync options that will be used for all modules.\n* One or more module sections.\n  These are module-specific config blocks to configure how to call rsync for a certain module. These sections have their names prefixed, like `module: books`.\n\n  Fields:\n  - `path`: The path of the source files to be synced _(Required)_.\n  - `transfer direction`: Either `push` or `pull`. Determines whether files for this module are sent to or received from the configured host _(Required)_.\n  - `opts`: Whitespace separated string of Rsync options that will be used (on top of the base options above) for this module specifically.\n\nYou can define your own fields for re-use later in the file as well. This is particularly useful when repeating something often, like a base path.\n\nSee the example below which demonstrates what's been layed out here. It's a valid config.\n\n### Example\n```ini\n[rsync]\nhost = me@host\npassword file = /home/me/.config/backup/rsync_password\nsource base path = /media/\nbase opts =\n    --itemize-changes\n    --verbose\n    --archive\n    --update\n    --delete\n    --password-file=${password file}\n\n[module: stuff]\ntransfer direction = pull\npath = ${rsync:source base path}/data/stuff\nopts = --partial --inplace\n\n[module: links]\ntransfer direction = push\npath = ${rsync:source base path}/data/.torrents\nopts = --whole-file --no-links\n```\n\n\n## Scheduling with journal logging\nUse `systemd-cat` to take in the output from the script and journal it. I myself have it scheduled (somewhat) like so:\n\n\n```shell\n# m h  dom mon dow   command\n03  04   *   *   *   /usr/local/bin/backup books libraries 2\u003e\u00261 | systemd-cat -t backup\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbartkl%2Fbackup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbartkl%2Fbackup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbartkl%2Fbackup/lists"}