Site icon Mr. 沙先生

茶包專欄 lsyncd 無法使用的 excludeFrom:Parameter “rsync.excludeFrom” unknown

今天在使用 lsyncd 的時候需要使用到 excludeFrom 的功能參數,但是怎麼樣都出現錯誤訊息

Starting lsyncd: Error: error preparing /etc/lsyncd.lua: Parameter "rsync.excludeFrom" unknown. (if this is not a typo add it to checkgauge)

 

在官方文件明明就寫了 rsync 支援 excludeFrom 參數,但卻無法使用,從錯誤訊息提示在 checkgauge 找不到屬性,需要在 checkgauge 加入

 

 

查看了一下編譯前的原始碼 rsync 的 checkgauge 並不是寫在 rsync table 裡面,而是寫在 sync table 裡面

-- used to ensure there aren't typos in the keys
--
rsync.checkgauge = {

	-- unsets default user action handlers
	onCreate    =  false,
	onModify    =  false,
	onDelete    =  false,
	onStartup   =  false,
	onMove      =  false,

	delete      =  true,
	exclude     =  true,
	excludeFrom =  true,
	target      =  true,

	rsync  = {
		acls              =  true,
		archive           =  true,
		binary            =  true,
		bwlimit           =  true,
		checksum          =  true,
		compress          =  true,
		copy_links        =  true,
		cvs_exclude       =  true,
		dry_run           =  true,
		executability     =  true,
		group             =  true,
		hard_links        =  true,
		ignore_times      =  true,
		inplace           =  true,
		ipv4              =  true,
		ipv6              =  true,
		keep_dirlinks     =  true,
		links             =  true,
		one_file_system   =  true,
		omit_dir_times    =  true,
		omit_link_times   =  true,
		owner             =  true,
		password_file     =  true,
		perms             =  true,
		protect_args      =  true,
		prune_empty_dirs  =  true,
		quiet             =  true,
		rsh               =  true,
		rsync_path        =  true,
		sparse            =  true,
		temp_dir          =  true,
		timeout           =  true,
		times             =  true,
		update            =  true,
		verbose           =  true,
		whole_file        =  true,
		xattrs            =  true,
		_extra            =  true,
	},
}

 

將 excludeFrom 寫在 sync {} 裡面就成功了!

 

嗯,小弟使用的是 2.1.5 版本,看來在細節的部份還有許多可以改進,

 

 

 

 

 

 

Exit mobile version