Rsnapshot 排除目錄不起作用

Rsnapshot 排除目錄不起作用

Rsnapshot 不排除我在 except_file 中指定的檔案。

設定檔

config_version  1.2
snapshot_root   /home/xxx/Backups/test/
cmd_cp  /bin/cp
cmd_rm  /bin/rm
cmd_rsync   /usr/bin/rsync
cmd_ssh /usr/bin/ssh
cmd_logger  /usr/bin/logger
cmd_du  /usr/bin/du
interval    hourly  6
interval    daily   7
interval    weekly  4
interval    monthly 3
verbose 2
loglevel    4
logfile /home/xxx/Desktop/local.log
exclude_file    /home/xxx/Desktop/local-exclude.txt
#rsync_long_args --delete --numeric-ids --delete-excluded
#lockfile   /var/run/rsnapshot.pid
backup_script   /home/xxx/Desktop/db-backup.sh  mysql/
backup  /var/www/dev/   test/
rsync_short_args    -avvv

本地排除.txt

exclude downloader/*
exclude var/*

rsnapshot 日誌文件

[19/Apr/2012:11:42:44] /usr/bin/rsnapshot -c local-rsnapshot.conf hourly: started
[19/Apr/2012:11:42:44] Setting locale to POSIX "C"
[19/Apr/2012:11:42:44] mkdir -m 0755 -p /home/xxx/Backups/test/hourly.0/
[19/Apr/2012:11:42:44] mkdir -m 0755 -p /home/xxx/Backups/test/tmp/
[19/Apr/2012:11:42:44] cd /home/xxx/Backups/test/tmp/
[19/Apr/2012:11:42:44] /home/xxx/Desktop/db-backup.sh
[19/Apr/2012:11:42:46] cd /home/xxx/Backups/test/
[19/Apr/2012:11:42:46] sync_if_different("/home/xxx/Backups/test/tmp/", "/home/xxx/Backups/test/hourly.0/mysql/")
[19/Apr/2012:11:42:46] /bin/rm -rf /home/xxx/Backups/test/tmp/
[19/Apr/2012:11:42:46] /usr/bin/rsync -avvv --delete --numeric-ids --relative --delete-excluded --exclude-from=/home/xxx/Desktop/local-exclude.txt /var/www/dev /home/xxx/Backups/test/hourly.0/test/
[19/Apr/2012:11:43:24] Some files and/or directories in /var/www/dev/ only transferred partially during rsync operation
[19/Apr/2012:11:43:24] touch /home/xxx/Backups/test/hourly.0/
[19/Apr/2012:11:43:24] WARNING: /usr/bin/rsnapshot -c local-rsnapshot.conf hourly: completed, but with some warnings

知道可能出什麼問題嗎?

答案1

問題是您在排除檔案中使用了 rsync 語法,而排除模式或 glob 是預期的。

引自rsnapshot(1)

排除文件/路徑/到/排除/文件

使用 --exclude-from 指令將其直接傳遞給 rsync。有關語法,請參閱 rsync(1) 手冊頁。

rsync(1)說:

--從=檔案中排除

此選項與 --exclude 選項相關,但它指定包含排除模式(每行一個)的 FILE。文件中的空白行和以“;”開頭的行或“#”被忽略。如果 FILE 為 -,則將從標準輸入讀取清單。

這是我的一個例子exclude_file

*~
\#*#
*.bak
*.old

由於您按路徑排除,我建議將 rsync-filter 放在適當的目錄中,例如,這就是我家中的:

include_/.emacs.d/
exclude_/.emacs.d/auto-save-list
exclude_/.emacs.d/eshell
exclude_/.emacs.d/image-dired
exclude_/.emacs.d/thumbs

相關內容