Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
980913ee2a
|
||
|
|
0773a384dd
|
||
|
|
4bce0edba5
|
||
|
|
be93015136
|
@@ -4,7 +4,7 @@
|
||||
|
||||
pkgname=simple_backup
|
||||
pkgdesc='Simple backup script that uses rsync to copy files'
|
||||
pkgver=4.6.1
|
||||
pkgver=4.6.2
|
||||
pkgrel=1
|
||||
url="https://git.shouldnt.work/fuxino/$pkgname"
|
||||
arch=('any')
|
||||
@@ -24,7 +24,7 @@ checkdepends=('python-pytest'
|
||||
conflicts=('simple_backup-git')
|
||||
source=("git+$url?signed#tag=$pkgver")
|
||||
validpgpkeys=('7E12BC1FF3B6EDB2CD8053EB981A2B2A3BBF5514')
|
||||
sha256sums=('3646012b0d50ca2cc1adcd7904bb34389e8d33724534730b48ae30de6b28f994')
|
||||
sha256sums=('bbe7b79669fe02ca4dc62fb08b8b5eaed809b5f1ece9586017af8ebf20d2faa0')
|
||||
|
||||
build()
|
||||
{
|
||||
|
||||
@@ -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.
|
||||
|
||||
+39
-30
@@ -1,31 +1,34 @@
|
||||
.TH SIMPLE_BACKUP 1 2026-11-02 SIMPLE_BACKUP 4.6.2
|
||||
.TH SIMPLE_BACKUP 1 2026-11-08 SIMPLE_BACKUP 4.6.3
|
||||
.SH NAME
|
||||
simple_backup \- Backup files and folders using rsync
|
||||
.SH SYNOPSIS
|
||||
.B simple_backup
|
||||
\-h, \-\-help
|
||||
.PD 0
|
||||
.P
|
||||
.PD
|
||||
.B simple_backup
|
||||
[\-c, \-\-config FILE]
|
||||
[\-i, \-\-input INPUT [INPUT...]]
|
||||
[\-o, \-\-output DIR]
|
||||
.PD 0
|
||||
.P
|
||||
.PD
|
||||
.RS 14 [\-e, \-\-exclude FILE|DIR|PATTERN [FILE|...]]
|
||||
[\-k, \-\-keep N]
|
||||
[\-\-ssh\-host HOSTNAME]
|
||||
[\-\-ssh\-user USERNAME]
|
||||
[\-\-keyfile FILE]
|
||||
.PD 0
|
||||
.P
|
||||
.PD
|
||||
[\-s, \-\-checksum]
|
||||
[\-z, \-\-compress]
|
||||
.SY simple_backup
|
||||
\-h,\~\-\-help
|
||||
.YS
|
||||
.SY simple_backup
|
||||
\-\-last\-backup
|
||||
[\-u,\~\-\-user\~USERNAME]
|
||||
.YS
|
||||
.SY simple_backup
|
||||
[\-v,\~\-\-verbose]
|
||||
[\-c,\~\-\-config\~FILE]
|
||||
[\-i,\~\-\-inputs\~INPUT\~[INPUT...]]
|
||||
[\-o,\~\-\-output\~DIR]
|
||||
[\-e,\~\-\-exclude\~FILE|DIR|PATTERN\~[FILE|...]]
|
||||
[\-k,\~\-\-keep\~N]
|
||||
[\-u,\~\-\-user\~USERNAME]
|
||||
[\-\-ssh\-host\~HOSTNAME]
|
||||
[\-\-ssh\-user\~USERNAME]
|
||||
[\-\-keyfile\~FILE]
|
||||
[\-\-remote\-sudo]
|
||||
[\-\-numeric\-ids]
|
||||
[\-s,\~\-\-checksum]
|
||||
[\-z,\~\-\-compress]
|
||||
[\-\-rsync\-options\~OPTION\~[OPTION...]]
|
||||
[\-\-remove\-before\-backup]
|
||||
.RE
|
||||
[\-\-no\-syslog]
|
||||
[\-\-no\-progress]
|
||||
.YS
|
||||
.SH DESCRIPTION
|
||||
.B simple_backup
|
||||
is a python script for performing backup of files and folders.
|
||||
@@ -36,15 +39,20 @@ in a configuration file (default location $HOME/.config/simple_backup/simple_bac
|
||||
or directly on the command line.
|
||||
.P
|
||||
Parameters specified on the command line will override those in the configuration file.
|
||||
The exceptions are remote_sudo and numeric_ids: if enabled in the configuration file, they
|
||||
can\(aqt be disabled on the command line.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \-h, \-\-help
|
||||
Print a short help message and exit.
|
||||
.TP
|
||||
.B \-v, \-\-verbose
|
||||
More verbose output.
|
||||
.TP
|
||||
.B \-c, \-\-config FILE
|
||||
Specify the configuration file, useful to specify a different one from the default.
|
||||
.TP
|
||||
.B \-i, \-\-input INPUT [INPUT...]
|
||||
.B \-i, \-\-inputs INPUT [INPUT...]
|
||||
Specify the files and directories to backup. Multiple inputs can be specified, just separate
|
||||
them with a space. If filenames or paths contain spaces, don't forget to escape them,
|
||||
or to use single or double quotes around them.
|
||||
@@ -64,7 +72,7 @@ not preserved either.
|
||||
.TP
|
||||
.B \-e, \-\-exclude FILE|DIR|PATTERN [FILE|...]]
|
||||
Specify files, directories or patterns to exclude from the backup. Matching files and directories
|
||||
will not be copied. Multiple elements can be specified, in the same way as for the \-\-input option.
|
||||
will not be copied. Multiple elements can be specified, in the same way as for the \-\-inputs option.
|
||||
.TP
|
||||
.B \-k, \-\-keep N
|
||||
Specify how many old backups (so excluding the current one) will be kept. The default behavior
|
||||
@@ -84,15 +92,15 @@ Hostname of the server where to copy the files in case of remote backup through
|
||||
Username for connecting to the server in case of remote backup.
|
||||
.TP
|
||||
.B \-\-keyfile FILE
|
||||
Location of the SSH key for server authentication.
|
||||
Location of the SSH key for server authentication.
|
||||
.TP
|
||||
.B \-s, \-\-checksums
|
||||
.B \-s, \-\-checksum
|
||||
Same as rsync option \(aq\-\-checksum\(aq, use checksums instead of mod\-time and size
|
||||
to skip files.
|
||||
.TP
|
||||
.B \-z, \-\-compress
|
||||
Compress data during transfer (rsync \(aq\-\-compress\(aq option). Useful for remote backup
|
||||
if saving bandwith is needed.
|
||||
if saving bandwidth is needed.
|
||||
.TP
|
||||
.B \-\-remove\-before\-backup
|
||||
Remove old backups (if necessary) before creating the new backup. Useful to free some space
|
||||
@@ -148,7 +156,8 @@ needs to be allowed to run without password in the same way.
|
||||
Use rsync \-\-numeric\-ids option. This causes rsync to use numeric uid/gid instead of trying to map uid/gid names from the local machine to the server.
|
||||
.TP
|
||||
.B \-\-last\-backup
|
||||
Print the date and directory of the last successful backup, then exit. The exit status is 0, or 1
|
||||
Print the date of the last successful backup and how long ago it was made (for example
|
||||
\(aqLast backup: 2026\-10\-25 14:03 (2 days ago)\(aq), then exit. The exit status is 0, or 1
|
||||
if no backup has been recorded yet or the state file can\(aqt be read (see
|
||||
.BR FILES ).
|
||||
.SH CONFIGURATION
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
"""Init."""
|
||||
|
||||
__version__ = '4.6.2'
|
||||
__version__ = '4.6.3'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Example config file for simple_backup
|
||||
|
||||
[backup]
|
||||
# Files and directories to backup. Multiple items can be separated using a comma (','). It is possible to use wildcards (i.e. '*' to match multiple characters and '~' for the user's home directory).
|
||||
# Files and directories to backup. Multiple items can be separated using a comma (','). It is possible to use wildcards (e.g. '*' to match multiple characters) and '~' for the user's home directory.
|
||||
inputs=/home/user
|
||||
|
||||
# Output directory. For remote backups, this is a path on the server ('~' and relative paths refer to the home directory on the server).
|
||||
@@ -13,7 +13,8 @@ exclude=*.bak
|
||||
# Number of old backups (i.e. excluding the one that's being created) to keep (use -1 to keep all)
|
||||
keep=-1
|
||||
|
||||
# Uncomment the following section to enable backup to remote server through ssh
|
||||
# Uncomment the following section to enable backup to remote server through ssh.
|
||||
# ssh_host can be an alias from ~/.ssh/config (its HostName, Port and IdentityFile are used)
|
||||
# [server]
|
||||
# ssh_host=
|
||||
# ssh_user=
|
||||
|
||||
Reference in New Issue
Block a user