Duplicity 通过 ftp 完成完整备份,然后被删除,全程无需用户操作。
有两件事我想知道;
- 以下信息中是否有任何内容可以解释这个问题?
- 在哪里可以找到 duplicity 的日志输出以提供一些帮助?
调用 duplicitylftp后端来自脚本的模块(完整脚本在问题末尾)。
# Do backup
duplicity $Options "$Source" "$Dest"
其中: 当 $Dest 是本地磁盘而非 ftp 时,备份后不会发生删除,即 据我所知,没有其他 duplicity 作业同时使用 ftp $Dest。我看到一个使用 ps.Journalctl 的 duplicity 进程也只显示 1 个作业正在运行;Dest=ftp://[email protected]/Public/backup
Dest=file://'/mnt/backup/root_backup/'
journalctl | grep -ia "backup_"
an 02 09:12:27 PC01 anacron[2828910]: Job `backup_local' started
Jan 02 09:14:08 PC01 anacron[2828910]: Job `backup_local' terminated (exit status: 1) (mailing output)
Jan 02 09:42:27 PC01 anacron[2828910]: Job `backup_NAS' started
以下命令在脚本的 ftp 和本地磁盘版本中均有出现。它们紧跟在备份命令之后。删除操作在备份后立即发生。
duplicity remove-all-but-n-full 2 --force "$Dest"
duplicity cleanup --force "$Dest"
然而;
- 这两个命令都不应删除所有备份数据;
- 删除发生在 ftp 后端,而不是本地磁盘后端。
目标 NAS 上的 ftp 守护进程的日志显示,正在通过 ftp 从源 PC 命令删除。
pid 2] CONNECT:
[pid 1] [frodo] OK LOGIN:
[pid 3] [frodo] OK DELETE:, "/Public/backup/duplicity-full.20231231T040136Z.vol897.difftar.gpg"
Duplicity 是这些 ftp 命令的唯一可能来源。如果有人知道在哪里可以找到 duplicity 日志输出,那可能会对我有帮助。
系统信息:
名称 -a Linux PC01 6.2.0-1018-lowlatency #18~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC 星期四 11 月 16 日 11:27:56 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
duplicity --版本 duplicity 0.8.21
lftp -v LFTP | 版本 4.9.2 | 版权所有 (c) 1996-2020 Alexander V. Lukyanov
---- 完整脚本 ----
#!/bin/sh
# shebang '!/bin/sh' refers to a symlink to default shell on system
# Provides: Backup
# Requires: duplicity, wmctrl, zenity, CLI shell, lftp
# Execution: via anacron, as root, script stored in /etc/cron.daily
# Filename: backup_PC01_NAS.sh
# Version: 1 of 30.12.2023
# Author: David Morrell ([email protected])
# Backup syntax
# duplicity [full|incremental] [options] source_directory target_url
# Set variables so duplicity does not prompt for them when the script is run N.B. script must be stored in secure location.
# Always unset variables at end of script i.e. unset <varname>
export PASSPHRASE='Fred' # Set passphrase for GPG key used to encrypt backup
# Set password for remote backend if required (works with most backends, FTP & others)
export FTP_PASSWORD='u&me4eva'
# Set other control variables
SectionSeparator='===================================================================='
Source='/'
Dest=ftp://[email protected]/Public/backup
ExcludeList=''/opt/config/duplicity/exclude_list''
IncludeList=''/opt/config/duplicity/include_list''
Options="--name='Backup_PC01_NAS'
--full-if-older-than 1M
--verbosity=info
--archive=/mnt/backup/duplicity_archive
--tempdir=/mnt/backup/duplicity_temp_NAS
--exclude-filelist="$ExcludeList"
--include-filelist="$IncludeList""
echo
echo 'Starting backup...'
echo $SectionSeparator
echo
echo 'Variables'
echo 'Source = ' $Source
echo 'Dest = ' $Dest
echo 'Exclude = ' $ExcludeList
echo 'Include = ' $IncludeList
echo 'Options = ' $Options
echo
# Do backup
duplicity $Options "$Source" "$Dest"
# Do clean up
echo 'Starting clean up...'
echo $SectionSeparator
echo
duplicity remove-all-but-n-full 2 --force "$Dest"
duplicity cleanup --force "$Dest"
echo
echo 'Done'
echo $SectionSeparator
echo
lastrun='Last run '$(date)
collstatus=$(duplicity collection-status $Dest | tail)
# Unset passphrase
unset PASSPHRASE
# unset FTP_PASSWORD
# Log last run
echo "$SectionSeparator\n$lastrun\n$SectionSeparator\n$collstatus" > lastrun.txt
# Show dialog with status of collection after last run
sleep 1
wmctrl -F -a "INFO" -b add,above & (zenity --display=:0.0 --width=600 --height=300 --info --title="Backup Check NAS" --text="$collstatus")
# --- EOF ---
[表里不一]