Fuxino baf5b07d23 Quote paths in commands run on the SSH server
Remote commands were built with f-strings, with paths either unquoted
or in double quotes. Paths with spaces broke ls and find, and $ or
backticks in a path were expanded by the server's shell. Quote every
path with shlex.quote.
2026-10-08 20:22:35 +02:00
2026-10-08 20:12:29 +02:00
2019-09-16 19:29:02 +02:00
2026-10-08 18:25:08 +02:00

simple_backup

A simple backup script

Description

simple_backup is a Python script that allows you to backup your files. Parameters like input files/directories, output directory etc. can be specified in a configuration file, or on the command line. Run:

simple_backup -h

to print all possible command line options.

Dependencies

The script uses rsync to actually run the backup, so you will have to install it on your system. For example on Arch Linux:

sudo pacman -Syu rsync

Optional dependencies are systemd-python to enable using systemd journal for logging, dbus-python for desktop notifications, and paramiko for remote backup.

Install

To install the program, first clone the repository:

git clone https://git.shouldnt.work/fuxino/simple_backup.git

Then install the tools required to build the package:

pip install --upgrade build

Finally, run:

cd simple_backup
python -m build --wheel
python -m pip install dist/*.whl

For Arch Linux and Arch-based distros, two packages are available in the AUR (aur.archlinux.org):

  • simple_backup for the release version
  • simple_backup-git for the git version

Old backups

The number of old backups to keep can be set with the --keep (or -k) argument (or in the configuration file). Old backups are only removed if rsync completes successfully, so that they are not deleted when the new backup may be incomplete. The only rsync error that is ignored is return code 24 (source files vanished during the transfer), which is common when backing up a live system.

Remote backup

Warning

This feature is experimental

It's possible to use a remote server as destination for the backup. Just use the --ssh-user and --ssh-host arguments (or set them in the configuration file). For this to work, rsync must be installed on the server too.

Server authentication

The best way to handle the authentication is to have an ssh agent running on your system, otherwise if a passphrase is necessary to unlock the ssh key, it will be necessary to enter it more than once. If needed, it's possible to specify the ssh key location with the --keyfile argument or in the configuration file.

To be able to connect to the user's ssh agent when running simple_backup with sudo, make sure to preserve the SSH_AUTH_SOCK environment variable. For example:

sudo --preserve-env=SSH_AUTH_SOCK -s simple_backup [options]

or by editing the sudoers file. If SSH key authentication is not available, password authentication will be used instead. Check the man page for more details.

S
Description
No description provided
Readme GPL-3.0
577 KiB
Languages
Python 96.8%
Shell 3.2%