Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
68b6d77f30
|
||
|
|
980913ee2a
|
||
|
|
0773a384dd
|
||
|
|
4bce0edba5
|
||
|
|
be93015136
|
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
pkgname=simple_backup
|
pkgname=simple_backup
|
||||||
pkgdesc='Simple backup script that uses rsync to copy files'
|
pkgdesc='Simple backup script that uses rsync to copy files'
|
||||||
pkgver=4.6.1
|
pkgver=4.6.3
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
url="https://git.shouldnt.work/fuxino/$pkgname"
|
url="https://git.shouldnt.work/fuxino/$pkgname"
|
||||||
arch=('any')
|
arch=('any')
|
||||||
@@ -24,7 +24,7 @@ checkdepends=('python-pytest'
|
|||||||
conflicts=('simple_backup-git')
|
conflicts=('simple_backup-git')
|
||||||
source=("git+$url?signed#tag=$pkgver")
|
source=("git+$url?signed#tag=$pkgver")
|
||||||
validpgpkeys=('7E12BC1FF3B6EDB2CD8053EB981A2B2A3BBF5514')
|
validpgpkeys=('7E12BC1FF3B6EDB2CD8053EB981A2B2A3BBF5514')
|
||||||
sha256sums=('3646012b0d50ca2cc1adcd7904bb34389e8d33724534730b48ae30de6b28f994')
|
sha256sums=('b1e7802fcd5e615c92f6007238b3699d69e3005e140d87a742283ef1cc6bd37f')
|
||||||
|
|
||||||
build()
|
build()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ simple_backup -h
|
|||||||
to print all possible command line options.
|
to print all possible command line options.
|
||||||
|
|
||||||
## Dependencies
|
## 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:
|
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
|
```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.
|
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.
|
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
|
## Old backups
|
||||||
The number of old backups to keep can be set with the --keep (or -k) argument (or in the configuration file).
|
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.
|
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
|
## 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`).
|
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.
|
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.
|
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
|
```bash
|
||||||
simple_backup --last-backup
|
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
|
## Remote backup
|
||||||
> **Warning**
|
> **Warning**
|
||||||
@@ -102,4 +109,6 @@ sudo --preserve-env=SSH_AUTH_SOCK -s simple_backup [options]
|
|||||||
|
|
||||||
or by editing the sudoers file.
|
or by editing the sudoers file.
|
||||||
If SSH key authentication is not available, password authentication will be used instead.
|
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.
|
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
|
.SH NAME
|
||||||
simple_backup \- Backup files and folders using rsync
|
simple_backup \- Backup files and folders using rsync
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.B simple_backup
|
.SY simple_backup
|
||||||
\-h, \-\-help
|
\-h,\~\-\-help
|
||||||
.PD 0
|
.YS
|
||||||
.P
|
.SY simple_backup
|
||||||
.PD
|
\-\-last\-backup
|
||||||
.B simple_backup
|
[\-u,\~\-\-user\~USERNAME]
|
||||||
[\-c, \-\-config FILE]
|
.YS
|
||||||
[\-i, \-\-input INPUT [INPUT...]]
|
.SY simple_backup
|
||||||
[\-o, \-\-output DIR]
|
[\-v,\~\-\-verbose]
|
||||||
.PD 0
|
[\-c,\~\-\-config\~FILE]
|
||||||
.P
|
[\-i,\~\-\-inputs\~INPUT\~[INPUT...]]
|
||||||
.PD
|
[\-o,\~\-\-output\~DIR]
|
||||||
.RS 14 [\-e, \-\-exclude FILE|DIR|PATTERN [FILE|...]]
|
[\-e,\~\-\-exclude\~FILE|DIR|PATTERN\~[FILE|...]]
|
||||||
[\-k, \-\-keep N]
|
[\-k,\~\-\-keep\~N]
|
||||||
[\-\-ssh\-host HOSTNAME]
|
[\-u,\~\-\-user\~USERNAME]
|
||||||
[\-\-ssh\-user USERNAME]
|
[\-\-ssh\-host\~HOSTNAME]
|
||||||
[\-\-keyfile FILE]
|
[\-\-ssh\-user\~USERNAME]
|
||||||
.PD 0
|
[\-\-keyfile\~FILE]
|
||||||
.P
|
[\-\-remote\-sudo]
|
||||||
.PD
|
[\-\-numeric\-ids]
|
||||||
[\-s, \-\-checksum]
|
[\-s,\~\-\-checksum]
|
||||||
[\-z, \-\-compress]
|
[\-z,\~\-\-compress]
|
||||||
|
[\-\-rsync\-options\~OPTION\~[OPTION...]]
|
||||||
[\-\-remove\-before\-backup]
|
[\-\-remove\-before\-backup]
|
||||||
.RE
|
[\-\-no\-syslog]
|
||||||
|
[\-\-no\-progress]
|
||||||
|
.YS
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.B simple_backup
|
.B simple_backup
|
||||||
is a python script for performing backup of files and folders.
|
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.
|
or directly on the command line.
|
||||||
.P
|
.P
|
||||||
Parameters specified on the command line will override those in the configuration file.
|
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
|
.SH OPTIONS
|
||||||
.TP
|
.TP
|
||||||
.B \-h, \-\-help
|
.B \-h, \-\-help
|
||||||
Print a short help message and exit.
|
Print a short help message and exit.
|
||||||
.TP
|
.TP
|
||||||
|
.B \-v, \-\-verbose
|
||||||
|
More verbose output.
|
||||||
|
.TP
|
||||||
.B \-c, \-\-config FILE
|
.B \-c, \-\-config FILE
|
||||||
Specify the configuration file, useful to specify a different one from the default.
|
Specify the configuration file, useful to specify a different one from the default.
|
||||||
.TP
|
.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
|
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,
|
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.
|
or to use single or double quotes around them.
|
||||||
@@ -64,7 +72,7 @@ not preserved either.
|
|||||||
.TP
|
.TP
|
||||||
.B \-e, \-\-exclude FILE|DIR|PATTERN [FILE|...]]
|
.B \-e, \-\-exclude FILE|DIR|PATTERN [FILE|...]]
|
||||||
Specify files, directories or patterns to exclude from the backup. Matching files and directories
|
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
|
.TP
|
||||||
.B \-k, \-\-keep N
|
.B \-k, \-\-keep N
|
||||||
Specify how many old backups (so excluding the current one) will be kept. The default behavior
|
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.
|
Username for connecting to the server in case of remote backup.
|
||||||
.TP
|
.TP
|
||||||
.B \-\-keyfile FILE
|
.B \-\-keyfile FILE
|
||||||
Location of the SSH key for server authentication.
|
Location of the SSH key for server authentication.
|
||||||
.TP
|
.TP
|
||||||
.B \-s, \-\-checksums
|
.B \-s, \-\-checksum
|
||||||
Same as rsync option \(aq\-\-checksum\(aq, use checksums instead of mod\-time and size
|
Same as rsync option \(aq\-\-checksum\(aq, use checksums instead of mod\-time and size
|
||||||
to skip files.
|
to skip files.
|
||||||
.TP
|
.TP
|
||||||
.B \-z, \-\-compress
|
.B \-z, \-\-compress
|
||||||
Compress data during transfer (rsync \(aq\-\-compress\(aq option). Useful for remote backup
|
Compress data during transfer (rsync \(aq\-\-compress\(aq option). Useful for remote backup
|
||||||
if saving bandwith is needed.
|
if saving bandwidth is needed.
|
||||||
.TP
|
.TP
|
||||||
.B \-\-remove\-before\-backup
|
.B \-\-remove\-before\-backup
|
||||||
Remove old backups (if necessary) before creating the new backup. Useful to free some space
|
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.
|
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
|
.TP
|
||||||
.B \-\-last\-backup
|
.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
|
if no backup has been recorded yet or the state file can\(aqt be read (see
|
||||||
.BR FILES ).
|
.BR FILES ).
|
||||||
.SH CONFIGURATION
|
.SH CONFIGURATION
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
"""Init."""
|
"""Init."""
|
||||||
|
|
||||||
__version__ = '4.6.2'
|
__version__ = '4.6.3'
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# Example config file for simple_backup
|
# Example config file for simple_backup
|
||||||
|
|
||||||
[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
|
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).
|
# 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)
|
# Number of old backups (i.e. excluding the one that's being created) to keep (use -1 to keep all)
|
||||||
keep=-1
|
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]
|
# [server]
|
||||||
# ssh_host=
|
# ssh_host=
|
||||||
# ssh_user=
|
# ssh_user=
|
||||||
|
|||||||
Reference in New Issue
Block a user