Compare commits
No commits in common. "master" and "3.4.1" have entirely different histories.
40
PKGBUILD
40
PKGBUILD
@ -1,40 +0,0 @@
|
|||||||
# PKGBUILD
|
|
||||||
|
|
||||||
# Maintainer: Daniele Fucini <dfucini [at] gmail [dot] com>
|
|
||||||
|
|
||||||
pkgname=simple_backup
|
|
||||||
pkgdesc='Simple backup script that uses rsync to copy files'
|
|
||||||
pkgver=4.1.6
|
|
||||||
pkgrel=1
|
|
||||||
url="https://git.shouldnt.work/fuxino/${pkgname}"
|
|
||||||
arch=('any')
|
|
||||||
license=('GPL-3.0-or-later')
|
|
||||||
makedepends=('git'
|
|
||||||
'python-setuptools'
|
|
||||||
'python-build'
|
|
||||||
'python-installer'
|
|
||||||
'python-wheel')
|
|
||||||
depends=('python>=3.10'
|
|
||||||
'rsync'
|
|
||||||
'python-dotenv')
|
|
||||||
optdepends=('python-systemd: use systemd log'
|
|
||||||
'python-dbus: for desktop notifications'
|
|
||||||
'python-paramiko: for remote backup through ssh')
|
|
||||||
conflicts=('simple_backup-git')
|
|
||||||
source=(git+${url}?signed#tag=${pkgver})
|
|
||||||
validpgpkeys=('7E12BC1FF3B6EDB2CD8053EB981A2B2A3BBF5514')
|
|
||||||
sha256sums=('b3b29d9e2e1b7b949e95674d9a401e8eeb0d5f898e8450473dce94f799ee9df3')
|
|
||||||
|
|
||||||
build()
|
|
||||||
{
|
|
||||||
cd ${srcdir}/${pkgname}
|
|
||||||
python -m build --wheel --no-isolation
|
|
||||||
}
|
|
||||||
|
|
||||||
package()
|
|
||||||
{
|
|
||||||
cd ${srcdir}/${pkgname}
|
|
||||||
python -m installer --destdir=${pkgdir} dist/*.whl
|
|
||||||
install -Dm644 ${pkgname}/${pkgname}.conf ${pkgdir}/usr/share/doc/${pkgname}/${pkgname}.conf
|
|
||||||
install -Dm644 man/${pkgname}.1 ${pkgdir}/usr/share/man/man1/${pkgname}.1
|
|
||||||
}
|
|
20
README.md
20
README.md
@ -49,23 +49,3 @@ For Arch Linux and Arch-based distros, two packages are available in the AUR (au
|
|||||||
- **simple_backup** for the release version
|
- **simple_backup** for the release version
|
||||||
- **simple_backup-git** for the git version
|
- **simple_backup-git** for the git version
|
||||||
|
|
||||||
## Remote backup
|
|
||||||
> **Warning**
|
|
||||||
> This feature is experimental
|
|
||||||
|
|
||||||
It's possible to use a remote server as destination for the backup. Just use the --username (or -u) and --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:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
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.
|
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
.TH SIMPLE_BACKUP 1 2025-03-30 SIMPLE_BACKUP 4.1.6
|
.TH SIMPLE_BACKUP 1 2023-06-01 SIMPLE_BACKUP 3.2.6
|
||||||
.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
|
.BR simple_backup
|
||||||
\-h, \-\-help
|
\-h, \-\-help
|
||||||
.PD 0
|
.PD 0
|
||||||
.P
|
.P
|
||||||
.PD
|
.PD
|
||||||
.B simple_backup
|
.BR simple_backup
|
||||||
[\-c, \-\-config FILE]
|
[\-c, \-\-config FILE]
|
||||||
[\-i, \-\-input INPUT [INPUT...]]
|
[\-i, \-\-input INPUT [INPUT...]]
|
||||||
[\-o, \-\-output DIR]
|
[\-o, \-\-output DIR]
|
||||||
@ -16,177 +16,71 @@ simple_backup \- Backup files and folders using rsync
|
|||||||
.PD
|
.PD
|
||||||
.RS 14 [\-e, \-\-exclude FILE|DIR|PATTERN [FILE|...]]
|
.RS 14 [\-e, \-\-exclude FILE|DIR|PATTERN [FILE|...]]
|
||||||
[\-k, \-\-keep N]
|
[\-k, \-\-keep N]
|
||||||
[\-\-ssh\-host HOSTNAME]
|
|
||||||
[\-\-ssh\-user USERNAME]
|
|
||||||
[\-\-keyfile FILE]
|
|
||||||
.PD 0
|
|
||||||
.P
|
|
||||||
.PD
|
|
||||||
[\-s, \-\-checksum]
|
[\-s, \-\-checksum]
|
||||||
[\-z, \-\-compress]
|
|
||||||
[\-\-remove\-before\-backup]
|
[\-\-remove\-before\-backup]
|
||||||
.RE
|
.RE
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.B simple_backup
|
.BR simple_backup
|
||||||
is a python script for performing backup of files and folders.
|
is a python script for performing backup of files and folders. It uses rsync to copy the files to the specified location.
|
||||||
.P
|
Parameters for the backup such as input files/directories, output location and files or folders to exclude can be specified
|
||||||
It uses rsync to copy the files to the specified location. Parameters for the backup such as
|
in a configuration file (default location $HOME/.config/simple_backup/simple_backup.conf) or directly on the command line.
|
||||||
input files/directories, output location and files or folders to exclude can be specified
|
|
||||||
in a configuration file (default location $HOME/.config/simple_backup/simple_backup.conf)
|
|
||||||
or directly on the command line.
|
|
||||||
.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.
|
||||||
.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 \-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, \-\-input 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.
|
||||||
them with a space. If filenames or paths contain spaces, don't forget to escape them,
|
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.
|
|
||||||
.TP
|
.TP
|
||||||
.B \-o, \-\-output DIR
|
.B \-o, \-\-output DIR
|
||||||
Specify the directory where the files will be copied. The program will automatically
|
Specify the directory where the files will be copied. The program will automatically create a subdirectory called
|
||||||
create a subdirectory called \(aqsimple_backup\(aq (if it does not already exist) and
|
\(aqsimple_backup\(aq (if it does not already exist) and inside this directory the actual backup directory (using
|
||||||
inside this directory the actual backup directory (using the current date and time).
|
the current date and time)
|
||||||
.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.
|
||||||
will not be copied. Multiple elements can be specified, in the same way as for the \-\-input option.
|
Multiple elements can be specified, in the same way as for the \-\-input 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 is to keep them all
|
||||||
is to keep them all (same as N=\-1).
|
(same as N=\-1)
|
||||||
.TP
|
|
||||||
.B \-u, \-\-user USERNAME
|
|
||||||
Explicitly specify the user running the backup (in case it is needed for home directory expansion).
|
|
||||||
.TP
|
|
||||||
.B \-\-ssh\-host HOSTNAME
|
|
||||||
Hostname of the server where to copy the files in case of remote backup through SSH.
|
|
||||||
.TP
|
|
||||||
.B \-\-ssh\-user USERNAME
|
|
||||||
Username for connecting to the server in case of remote backup.
|
|
||||||
.TP
|
|
||||||
.B \-\-keyfile FILE
|
|
||||||
Location of the SSH key for server authentication.
|
|
||||||
.TP
|
.TP
|
||||||
.B \-s, \-\-checksums
|
.B \-s, \-\-checksums
|
||||||
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
|
|
||||||
.B \-z, \-\-compress
|
|
||||||
Compress data during transfer (rsync \(aq\-\-compress\(aq option). Useful for remote backup
|
|
||||||
if saving bandwith 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 before performing the backup.
|
||||||
before performing the backup.
|
|
||||||
Default behavior is to remove old backups after successfully completing the backup.
|
Default behavior is to remove old backups after successfully completing the backup.
|
||||||
.TP
|
.TP
|
||||||
.B \-\-no\-syslog
|
.B \-\-no\-syslog
|
||||||
Don't use systemd journal for logging.
|
Don't use systemd journal for logging
|
||||||
.TP
|
|
||||||
.B \-\-rsync\-options OPTIONS [OPTION...]
|
|
||||||
By default, the following rsync options are used:
|
|
||||||
.RS
|
|
||||||
.P
|
|
||||||
\-a \-r \-v \-h \-s \-H \-X
|
|
||||||
.P
|
|
||||||
Using \-\-rsync\-options it is possible to manually select which options to use. Supported values are the following:
|
|
||||||
.P
|
|
||||||
\-a, \-l, \-p, \-t, \-g, \-o, \-c, \-h, \-D, \-H, \-X, \-s
|
|
||||||
.P
|
|
||||||
Options \-r and \-v are used in any case. Not that options must be specified without dash (\-), for example:
|
|
||||||
.P
|
|
||||||
.EX
|
|
||||||
simple_backup \-\-rsync\-options a l p
|
|
||||||
.EE
|
|
||||||
.P
|
|
||||||
Check
|
|
||||||
.BR rsync (1)
|
|
||||||
for details about the options.
|
|
||||||
.RE
|
|
||||||
.TP
|
|
||||||
.B \-\-remote\-sudo
|
|
||||||
Run rsync on the remote server with sudo. This is needed if you want to preserve the owner of the files/folders to be copied (rsync \-\-owner option). For this to work the user used to login to the server obviously need to be allowed to use sudo. In addition, the user need to be able to run rsync with sudo without a password. To do this, /etc/sudoers on the server need to be edited adding a line like this one:
|
|
||||||
.RS
|
|
||||||
.P
|
|
||||||
<username> ALL=NOPASSWD:<path/to/rsync>
|
|
||||||
.P
|
|
||||||
To be able to remove old backups generated with \-\-remote\-sudo (see \-\-keep option), also
|
|
||||||
.BR rm (1)
|
|
||||||
needs to be allowed to run without password in the same way.
|
|
||||||
.RE
|
|
||||||
.TP
|
|
||||||
.B \-\-numeric\-ids
|
|
||||||
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.
|
|
||||||
.SH CONFIGURATION
|
.SH CONFIGURATION
|
||||||
An example configuration file is provided at \(aq/usr/share/doc/simple_backup/simple_backup.conf\(aq.
|
An example configuration file is provided at \(aq/etc/simple_backup/simple_backup.conf\(aq. Copy it to the default location
|
||||||
Copy it to the default location ($HOME/.config/simple_backup) and edit it as needed.
|
($HOME/.config/simple_backup) and edit it as needed.
|
||||||
.SH REMOTE BACKUP
|
|
||||||
It is possible to choose a directory on a remote server as destination for the backup. The files
|
|
||||||
are copied by rsync through SSH. Server hostname and username must be specified, either in the
|
|
||||||
configuration file, or on the command line (\(aq\-\-ssh\-host\(aq and \(aq\-\-ssh\-user\(aq options).
|
|
||||||
.SS AUTHENTICATION
|
|
||||||
For authentication, it is possible to use SSH key or password.
|
|
||||||
.P
|
|
||||||
When using SSH key, the best way to connect to the server is to have an SSH agent running.
|
|
||||||
Otherwise, if the SSH key is encrypted, it will be necessary to enter the passphrase more
|
|
||||||
than once. It is possible to specify the SSH key to use with the option \(aq\-\-keyfile\(aq,
|
|
||||||
if necessary.
|
|
||||||
.P
|
|
||||||
When running
|
|
||||||
.B simple_backup
|
|
||||||
with
|
|
||||||
.B sudo,
|
|
||||||
in order to connect to the user\(aqs SSH agent it is necessary to preserve the \(aqSSH_AUTH_SOCK\(aq environment variable, for example:
|
|
||||||
.P
|
|
||||||
.EX
|
|
||||||
sudo --preserve-env=SSH_AUTH_SOCK -s simple_backup [options]
|
|
||||||
.EE
|
|
||||||
.P
|
|
||||||
It is also possible to make this permanent by editing the
|
|
||||||
.B sudoers
|
|
||||||
file (see
|
|
||||||
.BR sudoers (5))
|
|
||||||
.P
|
|
||||||
If SSH key authentication is not available, password authentication will be used instead.
|
|
||||||
Note that in this case
|
|
||||||
.B sshpass
|
|
||||||
(if available) will be used to send the password to rsync, to avoid prompting the user for
|
|
||||||
the password multiple
|
|
||||||
times. This can pose some security risks, see
|
|
||||||
.BR sshpass (1)
|
|
||||||
for details. For this reason, use SSH key authentication if possible.
|
|
||||||
.SH EXIT STATUS
|
.SH EXIT STATUS
|
||||||
.TP
|
.TP
|
||||||
.B 0
|
.B 0
|
||||||
The backup was completed without errors.
|
The backup was completed without errors
|
||||||
.TP
|
.TP
|
||||||
.B 1
|
.B 1
|
||||||
No valid inputs selected for backup.
|
No valid inputs selected for backup
|
||||||
.TP
|
.TP
|
||||||
.B 2
|
.B 2
|
||||||
Backup failed because output directory for storing the backup does not exist.
|
Backup failed because output directory for storing the backup does not exist
|
||||||
.TP
|
.TP
|
||||||
.B 3
|
.B 3
|
||||||
Permission denied to access the output directory.
|
Permission denied to access the output directory
|
||||||
.TP
|
.TP
|
||||||
.B 4
|
.B 4
|
||||||
rsync error (rsync returned a non-zero value).
|
rsync error (rsync returned a non-zero value)
|
||||||
.TP
|
|
||||||
.B 5
|
|
||||||
SSH connection failed.
|
|
||||||
.TP
|
|
||||||
.B 6
|
|
||||||
Bad configuration file.
|
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR rsync (1)
|
.BR rsync (1)
|
||||||
.SH AUTHORS
|
.SH AUTHORS
|
||||||
.MT https://git.shouldnt.work/fuxino
|
.MT https://github.com/Fuxino
|
||||||
Daniele Fucini
|
Daniele Fucini
|
||||||
.ME
|
.ME
|
||||||
|
13
setup.cfg
13
setup.cfg
@ -6,22 +6,23 @@ long_description = file: README.md
|
|||||||
author = Daniele Fucini
|
author = Daniele Fucini
|
||||||
author_email = dfucini@gmail.com
|
author_email = dfucini@gmail.com
|
||||||
license = GPL3
|
license = GPL3
|
||||||
url = https://git.shouldnt.work/fuxino
|
url = https://github.com/Fuxino/simple_backup
|
||||||
classifiers =
|
classifiers =
|
||||||
Development Status :: 4 - Beta
|
Development Status :: 5 - Production/Stable
|
||||||
Environment :: Console
|
Environment :: Console
|
||||||
License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
||||||
Natural Language :: English
|
Natural Language :: English
|
||||||
Operating System :: POSIX :: Linux
|
Operating System :: POSIX :: Linux
|
||||||
|
Programming Language :: Python :: 3.7
|
||||||
|
Programming Language :: Python :: 3.8
|
||||||
|
Programming Language :: Python :: 3.9
|
||||||
Programming Language :: Python :: 3.10
|
Programming Language :: Python :: 3.10
|
||||||
Programming Language :: Python :: 3.11
|
Programming Language :: Python :: 3.11
|
||||||
Programming Language :: Python :: 3.12
|
|
||||||
Programming Language :: Python :: 3.13
|
|
||||||
Topic :: System :: Archiving :: Backup
|
Topic :: System :: Archiving :: Backup
|
||||||
|
|
||||||
[options]
|
[options]
|
||||||
packages = simple_backup
|
packages = simple_backup
|
||||||
python_requires = >=3.10
|
python_requires = >=3.7
|
||||||
install_requires =
|
install_requires =
|
||||||
python-dotenv
|
python-dotenv
|
||||||
|
|
||||||
@ -30,8 +31,6 @@ JOURNAL =
|
|||||||
systemd-python
|
systemd-python
|
||||||
NOTIFICATIONS =
|
NOTIFICATIONS =
|
||||||
dbus-python
|
dbus-python
|
||||||
REMOTE =
|
|
||||||
paramiko
|
|
||||||
|
|
||||||
[options.entry_points]
|
[options.entry_points]
|
||||||
console_scripts =
|
console_scripts =
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
"""Init."""
|
"""Init."""
|
||||||
|
|
||||||
__version__ = '4.1.6'
|
__version__ = '3.4.1'
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
# Example config file for simple_backup
|
# Example config file for simple_backup
|
||||||
|
|
||||||
[backup]
|
[default]
|
||||||
# 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 (i.e. '*' to match multiple characters and '~' for the user's home directory).
|
||||||
inputs=/home/user
|
inputs=/home/my_home,/etc
|
||||||
|
|
||||||
# Output directory.
|
# Output directory.
|
||||||
backup_dir=/media/Backup
|
backup_dir=/media/Backup
|
||||||
@ -12,11 +12,3 @@ 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
|
|
||||||
# [server]
|
|
||||||
# ssh_host=
|
|
||||||
# ssh_user=
|
|
||||||
# ssh_keyfile=
|
|
||||||
# remote_sudo=
|
|
||||||
# numeric_ids=
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user