Skip to main content

Mount file systems and backup directories.

Travis CI Build Status

This program copies source paths optionally mountable targets. You can configure whether or not a target is mountable or not. If it is, the program mounts the file system by looking for a info.conf file and mounts if the file is not found. The program only looks to see if this file exists and does not do anything with the contents.

Features:

  • Mounts file systems only when necessary
  • Unmounts only file systems mounted
  • Customizable rsync (and mount/umount) commands.
  • Easy/intuitive configuration.
  • Need not be rsync, you can customize the backup to whatever you want.

Table of Contents

Usage

  1. Install the library, which also installs the command.
  2. Create a configuration file (default is /etc/rbak.conf if -c is not given): See the test case configuration file for an example.
  3. Check your configuration: $ rbak info
  4. Backup using a dry run (i.e. careful with rsync's --delete): $ rbak --dryrun backup
  5. Start the backup: $ rbak backup

Configuration

See the test case configuration file, which has the explains each line of configuration in detail.

Here's a sample:

## default section has configuration shared with all targets and sources
[default]
# name of file to look for in targets to determine if mounted
info_file=info.conf
# default name of backup directory for each target--this gets appended to the
# target's path
backup_dir=bak
# commands for mounting, un-mounting and backing up
mount_cmd=/bin/mount -L {name} {path}
umount_cmd=/bin/umount {path}
backup_cmd=rsync -rltpgoDuv --delete {source.path}/ {target.backup_path}/{source.basename}
# list of targets and sources, each of which need their own sections
targets=extbak2t
sources=git

## target `extbak2t` is an example of a mountable file system (i.e. USB drive)
[extbak2t]
# declare this to be a mountable file system
mountable=true
# path resolves to /mnt/extbak2t ({name} is the target/section name)
path=/mnt/{name}

## the one and only source for this configuration
[git]
# path of where files will be copied from
path=/opt/var/git
# override the basenme target backup directory
basename_dir=other/gitpath

The backup_cmd need not be an rsync command, it can be anything and you can use any property of the source and target that are generated at runtime, but it can also by any property of these classes.

The global default section's backup_dir variable is shared with all targets and sources. This variable is appended to the target's path so the program can differentiate between the mount point and the path to back up files.

The basename_dir property in sources overrides the source.basenme property in backup_cmd. If this is not given it defaults to the basename of the source's path property.

This program was written KISS (keep it simple) philosophy. If you have a transitive backup situation (i.e. backup A -> B, then B -> C), it's better to break this out into two separate configuration files and two separate backup invocations. That said, in some cases you may be able to utilize the --sources option to set which sources to backup.

Help

The usage is given with -h:

$ rbak -h
Usage: rbak <list|...> [options]

Options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -s, --short           short output for list
  -w NUMBER, --whine=NUMBER
                        add verbosity to logging
  -c FILE, --config=FILE
                        configuration file


Usage: rbak backup [additional options]

Run the backup

Options:
  -d, --dryrun   dry run to not actually connect, but act like it
  -n, --sources  override the sources property in the config
  -h, --help     show this help message and exit


Usage: rbak mount [additional options]

Mount all targets

Options:
  -d, --dryrun  dry run to not actually connect, but act like it
  -h, --help    show this help message and exit


Usage: rbak umount [additional options]

Un-mount all targets

Options:
  -d, --dryrun  dry run to not actually connect, but act like it
  -h, --help    show this help message and exit

Obtaining

The easist way to install the command line program is via the pip installer:

pip install zensols.rbak

Binaries are also available on pypi.

Changelog

An extensive changelog is available here.

License

Copyright (c) 2018 Paul Landes

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Release files for zensols.rbak 0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for zensols.rbak 0.4
File Interpreter ABI Platform
zensols.rbak-0.4-py3.6.egg Legacy Egg format - - Details
zensols.rbak-0.4-py3-none-any.whl Python 3 none any Details

Total release size: 19.6 kB

Release files / zensols.rbak-0.4-py3.6.egg

Download URL zensols.rbak-0.4-py3.6.egg
Size 12.4 kB
Tags Egg
SHA-256 checksum
How to use checksums
5dae5ec97ef70ea001b6066a214af4d7e048dc280526944eb2757c11121530a4
BLAKE2b-256 checksum
How to use checksums
d593ae66b4145da91ea7afc2174b0d755811dd96e369a3553e027d3d8068010d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / zensols.rbak-0.4-py3-none-any.whl

Download URL zensols.rbak-0.4-py3-none-any.whl
Size 7.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3a18d915839bcabcaebcdcbcd11a25fe7838b3dca685048f3d9fc4630f5d74bc
BLAKE2b-256 checksum
How to use checksums
0d354e8729af1eaa71c177bc546bf8078cc7accb216bd632febcb4664545d4f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.4 This release

2 release files

0.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page