diff --git a/README.md b/README.md index fb6f9a7..32739de 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ simple_backup -h to print all possible command line options. ## Dependencies +simple_backup requires Python 3.10 or later. The script uses rsync to actually run the backup, so you will have to install it on your system. For example on Arch Linux: ```bash @@ -57,22 +58,28 @@ To back up files that your user can't read, run simple_backup with sudo or doas. In that case the user who ran the command is detected automatically, so that '~' (in the inputs and in the default configuration file path) refers to that user's home directory, not root's. When running as root in other ways (e.g. from a systemd service), specify the user with the --user (or -u) argument. +## Progress +When run in a terminal, simple_backup shows a progress bar with the percentage of files copied and an estimated time to completion. +Disable it with --no-progress. + ## 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. +By default, 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. +To free space on the destination first, use --remove-before-backup: old backups are then removed before rsync starts, even if the new backup fails. ## Last backup After each successful backup, simple_backup saves its time and directory to `~/.local/state/simple_backup/last_backup` (or `$XDG_STATE_HOME/simple_backup/last_backup`). It also saves the number of files, so that the next run can show progress and an estimated time while rsync is still looking for files. When run with sudo or doas, the file goes to the home directory of the user who ran the command. -Print it with: +To see when the last backup was made (e.g. `Last backup: 2026-10-25 14:03 (2 days ago)`), run: ```bash simple_backup --last-backup ``` -The file has two lines: the completion time in ISO 8601 format (e.g. `2026-10-25T14:03:12+02:00`) and the backup directory, so scripts (e.g. a status bar indicator) can easily read it to remind you when a backup is overdue. +The first line of the file is the completion time in ISO 8601 format (e.g. `2026-10-25T14:03:12+02:00`), the second the backup directory, and the third (if known) the number of files. +Scripts (e.g. a status bar indicator) can easily read the first line to remind you when a backup is overdue. ## Remote backup > **Warning** @@ -102,4 +109,6 @@ 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. +In that case, if sshpass is installed, it is used to pass the password to rsync, so that you only have to enter it once; otherwise you will be asked for it more than once. +sshpass has some security risks (see sshpass(1)), so use SSH key authentication if possible. Check the man page for more details.