UNISON文件同步
生活随笔
收集整理的這篇文章主要介紹了
UNISON文件同步
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1.使用環境
下載地址:可以百度搜索unison sync,也可以直接訪問官網地址https://www.cis.upenn.edu/~bcpierce/unison/
兩臺windows設備(理論上服務端客戶端在任意支持平臺均可)
2.部署方式
一臺作為服務端,偵聽端口,另外一臺作為客戶端直接同步
2.1.服務端部署
下載后解壓,直接使用命令行
可以使用命令行進入當前目錄,也可以直接使用絕對路徑直接打開(如果通過FTP或者ssh或者webdav等方式打通,可以不用部署服務端,直接進入客戶端使用步驟)
運行后可以返回以下信息,標識運行正常(可以通過netstat -ano | findstr 54321查看是否已啟動偵聽)
server started后續如果需要自動開啟,可以直接使用定時計劃執行命令或者直接調用批處理
注意:由于該服務被telnet直接輸入非法字符后會自動退出,可以考慮批處理增加進程檢測腳本,檢測有異常自動拉起,可以通過定時計劃設置檢查間隔(以下內容復制保存在批處理中,放在主程序所在目錄)
//進入unison.exe主程序所在絕對路徑 cd /d %~dp0 //檢查54321端口是否偵聽,如果沒有偵聽,啟動對應服務 netstat -ano | findstr 54321| findstr LISTENING ||unison.exe -socket 543212.2.客戶端配置
下載后解壓,直接使用命令行
可以使用命令行進入當前目錄,也可以直接使用絕對路徑直接打開,當然也可以使用GUI形式(比較簡單就不做展開了)
3.補充說明
定時計劃設置細節:
因為存在可能使用批處理執行或者GUI執行,因此建議使用以上腳本,容錯,避免雙開。
定時計劃設置時需要關注以下開關(win11不開啟,觸發任務時會非常卡頓,開啟后通過啟動腳本判斷程序在運行直接退出即可,未運行則啟動):
使用幫助說明
\bin>unison.exe --help Usage: unison [options]or unison root1 root2 [options]or unison profilename [options]Basic options:General:-doc xxx show documentation ('-doc topics' lists topics)-version print version and exitWhat to sync:-group synchronize group attributes-ignore xxx add a pattern to the ignore list-ignorenot xxx add a pattern to the ignorenot list-nocreation xxx prevent file creations on one replica-nodeletion xxx prevent file deletions on one replica-noupdate xxx prevent file updates and deletions on one replica-owner synchronize owner-path xxx path to synchronize-perms n part of the permissions which is synchronized-root xxx root of a replica (should be used exactly twice)-times synchronize modification timesHow to sync:-batch batch mode: ask no questions at allHow to sync (text interface (CLI) only):-auto automatically accept default (nonconflicting) actions-silent print nothing except error messages-terse suppress status messagesText interface (CLI):-i interactive profile mode (text UI); command-line onlyAdvanced options:Fine-tune sync:-acl synchronize ACLs-atomic xxx add a pattern to the atomic list-follow xxx add a pattern to the follow list-force xxx force changes from this replica to the other-forcepartial xxx add a pattern to the forcepartial list-ignorecase xxx identify upper/lowercase filenames (true/false/default)-immutable xxx add a pattern to the immutable list-immutablenot xxx add a pattern to the immutablenot list-links xxx allow the synchronization of symbolic links(true/false/default)-merge xxx add a pattern to the merge list-nocreationpartial xxx add a pattern to the nocreationpartial list-nodeletionpartial xxx add a pattern to the nodeletionpartial list-noupdatepartial xxx add a pattern to the noupdatepartial list-prefer xxx choose this replica's version for conflicting changes-preferpartial xxx add a pattern to the preferpartial list-rsrc xxx synchronize resource forks (true/false/default)-xattrignore xxx add a pattern to the xattrignore list-xattrignorenot xxx add a pattern to the xattrignorenot list-xattrs synchronize extended attributes (xattrs)How to sync:-backup xxx add a pattern to the backup list-backupcurr xxx add a pattern to the backupcurr list-backupcurrnot xxx add a pattern to the backupcurrnot list-backupdir xxx directory for storing centralized backups-backuploc xxx where backups are stored ('local' or 'central')-backupnot xxx add a pattern to the backupnot list-backupprefix xxx prefix for the names of backup files-backups (deprecated) keep backup copies of all files (see also'backup')-backupsuffix xxx a suffix to be added to names of backup files-confirmbigdel ask about whole-replica (or path) deletes (default true)-confirmmerge ask for confirmation before committing results of a merge-copyonconflict keep copies of conflicting files-dontchmod when set, never use the chmod system call-fastcheck xxx do fast update detection (true/false/default)-fat use appropriate options for FAT filesystems-ignoreinodenumbers ignore inode number changes when detecting updates-maxbackups n number of backed up versions of a file-numericids don't map uid/gid values by user/group names-sortbysize list changed files by size, not name-sortfirst xxx add a pattern to the sortfirst list-sortlast xxx add a pattern to the sortlast list-sortnewfirst list new before changed filesHow to sync (text interface (CLI) only):-repeat xxx synchronize repeatedly (text interface only)-retry n re-try failed synchronizations N times (text ui only)Text interface (CLI):-color xxx use color output for text UI (true/false/default)-dumbtty do not change terminal settings in text UIGraphical interface (GUI):-height n height (in lines) of main window in graphical interfaceRemote connections:-addversionno add version number to name of unison on server-clientHostName xxx set host name of client-halfduplex (deprecated) force half-duplex communication with theserver-killserver kill server when done (even when using sockets)-listen xxx listen on this name or addr in server socket mode (canrepeat)-rsync activate the rsync transfer mode (default true)-servercmd xxx name of unison executable on remote server-socket xxx act as a server on a socket-sshargs xxx other arguments (if any) for remote shell command-sshcmd xxx path to the ssh executable-stream (deprecated) use a streaming protocol for transferringfile contents (default true)-testserver exit immediately after the connection to the server-xferbycopying optimize transfers using local copies (default true)Archive management:-ignorearchives ignore existing archive filesOther:-addprefsto xxx file to add new prefs to-contactquietly suppress the 'contacting server' message during startup-copymax n maximum number of simultaneous copyprog transfers-copyprog xxx external program for copying large files-copyprogrest xxx variant of copyprog for resuming partial transfers-copyquoterem xxx add quotes to remote file name for copyprog(true/false/default)-copythreshold n use copyprog on files bigger than this (if >=0, in Kb)-diff xxx set command for showing differences between files-ignorelocks ignore locks left over from previous run (dangerous!)-include xxx include a profile's preferences-key xxx define a keyboard shortcut for this profile (in some UIs)-label xxx provide a descriptive string label for this profile-log record actions in logfile (default true)-logfile xxx logfile name-maxerrors n maximum number of errors before a directory transfer isaborted-maxsizethreshold n prevent transfer of files bigger than this (if >=0, inKb)-maxthreads n maximum number of simultaneous file transfers-mountpoint xxx abort if this path does not exist-rootalias xxx register alias for canonical root names-showarchive show 'true names' (for rootalias) of roots and archive-source xxx include a file's preferences-ui xxx select UI ('text' or 'graphic'); command-line only-unicode xxx assume Unicode encoding in case insensitive mode-watch when set, use a file watcher process to detect changesExpert options:-debug xxx debug module xxx ('all' -> everything, 'verbose' -> more)-dumparchives dump contents of archives just after loading-fastercheckUNSAFE skip computing fingerprints for new files (experts only!)-selftest run internal tests and exitunison.exe: unknown option `--help'.總結
以上是生活随笔為你收集整理的UNISON文件同步的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: JS视频播放
- 下一篇: easyui filebox 上传类型控