csync.html 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
  2. "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  4. <head>
  5. <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
  6. <meta name="generator" content="AsciiDoc 8.6.6" />
  7. <title>CSYNC User Guide</title>
  8. <style type="text/css">
  9. /* Shared CSS for AsciiDoc xhtml11 and html5 backends */
  10. /* Default font. */
  11. body {
  12. font-family: Georgia,serif;
  13. }
  14. /* Title font. */
  15. h1, h2, h3, h4, h5, h6,
  16. div.title, caption.title,
  17. thead, p.table.header,
  18. #toctitle,
  19. #author, #revnumber, #revdate, #revremark,
  20. #footer {
  21. font-family: Arial,Helvetica,sans-serif;
  22. }
  23. body {
  24. margin: 1em 5% 1em 5%;
  25. }
  26. a {
  27. color: blue;
  28. text-decoration: underline;
  29. }
  30. a:visited {
  31. color: fuchsia;
  32. }
  33. em {
  34. font-style: italic;
  35. color: navy;
  36. }
  37. strong {
  38. font-weight: bold;
  39. color: #083194;
  40. }
  41. h1, h2, h3, h4, h5, h6 {
  42. color: #527bbd;
  43. margin-top: 1.2em;
  44. margin-bottom: 0.5em;
  45. line-height: 1.3;
  46. }
  47. h1, h2, h3 {
  48. border-bottom: 2px solid silver;
  49. }
  50. h2 {
  51. padding-top: 0.5em;
  52. }
  53. h3 {
  54. float: left;
  55. }
  56. h3 + * {
  57. clear: left;
  58. }
  59. h5 {
  60. font-size: 1.0em;
  61. }
  62. div.sectionbody {
  63. margin-left: 0;
  64. }
  65. hr {
  66. border: 1px solid silver;
  67. }
  68. p {
  69. margin-top: 0.5em;
  70. margin-bottom: 0.5em;
  71. }
  72. ul, ol, li > p {
  73. margin-top: 0;
  74. }
  75. ul > li { color: #aaa; }
  76. ul > li > * { color: black; }
  77. pre {
  78. padding: 0;
  79. margin: 0;
  80. }
  81. #author {
  82. color: #527bbd;
  83. font-weight: bold;
  84. font-size: 1.1em;
  85. }
  86. #email {
  87. }
  88. #revnumber, #revdate, #revremark {
  89. }
  90. #footer {
  91. font-size: small;
  92. border-top: 2px solid silver;
  93. padding-top: 0.5em;
  94. margin-top: 4.0em;
  95. }
  96. #footer-text {
  97. float: left;
  98. padding-bottom: 0.5em;
  99. }
  100. #footer-badges {
  101. float: right;
  102. padding-bottom: 0.5em;
  103. }
  104. #preamble {
  105. margin-top: 1.5em;
  106. margin-bottom: 1.5em;
  107. }
  108. div.imageblock, div.exampleblock, div.verseblock,
  109. div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
  110. div.admonitionblock {
  111. margin-top: 1.0em;
  112. margin-bottom: 1.5em;
  113. }
  114. div.admonitionblock {
  115. margin-top: 2.0em;
  116. margin-bottom: 2.0em;
  117. margin-right: 10%;
  118. color: #606060;
  119. }
  120. div.content { /* Block element content. */
  121. padding: 0;
  122. }
  123. /* Block element titles. */
  124. div.title, caption.title {
  125. color: #527bbd;
  126. font-weight: bold;
  127. text-align: left;
  128. margin-top: 1.0em;
  129. margin-bottom: 0.5em;
  130. }
  131. div.title + * {
  132. margin-top: 0;
  133. }
  134. td div.title:first-child {
  135. margin-top: 0.0em;
  136. }
  137. div.content div.title:first-child {
  138. margin-top: 0.0em;
  139. }
  140. div.content + div.title {
  141. margin-top: 0.0em;
  142. }
  143. div.sidebarblock > div.content {
  144. background: #ffffee;
  145. border: 1px solid #dddddd;
  146. border-left: 4px solid #f0f0f0;
  147. padding: 0.5em;
  148. }
  149. div.listingblock > div.content {
  150. border: 1px solid #dddddd;
  151. border-left: 5px solid #f0f0f0;
  152. background: #f8f8f8;
  153. padding: 0.5em;
  154. }
  155. div.quoteblock, div.verseblock {
  156. padding-left: 1.0em;
  157. margin-left: 1.0em;
  158. margin-right: 10%;
  159. border-left: 5px solid #f0f0f0;
  160. color: #888;
  161. }
  162. div.quoteblock > div.attribution {
  163. padding-top: 0.5em;
  164. text-align: right;
  165. }
  166. div.verseblock > pre.content {
  167. font-family: inherit;
  168. font-size: inherit;
  169. }
  170. div.verseblock > div.attribution {
  171. padding-top: 0.75em;
  172. text-align: left;
  173. }
  174. /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
  175. div.verseblock + div.attribution {
  176. text-align: left;
  177. }
  178. div.admonitionblock .icon {
  179. vertical-align: top;
  180. font-size: 1.1em;
  181. font-weight: bold;
  182. text-decoration: underline;
  183. color: #527bbd;
  184. padding-right: 0.5em;
  185. }
  186. div.admonitionblock td.content {
  187. padding-left: 0.5em;
  188. border-left: 3px solid #dddddd;
  189. }
  190. div.exampleblock > div.content {
  191. border-left: 3px solid #dddddd;
  192. padding-left: 0.5em;
  193. }
  194. div.imageblock div.content { padding-left: 0; }
  195. span.image img { border-style: none; }
  196. a.image:visited { color: white; }
  197. dl {
  198. margin-top: 0.8em;
  199. margin-bottom: 0.8em;
  200. }
  201. dt {
  202. margin-top: 0.5em;
  203. margin-bottom: 0;
  204. font-style: normal;
  205. color: navy;
  206. }
  207. dd > *:first-child {
  208. margin-top: 0.1em;
  209. }
  210. ul, ol {
  211. list-style-position: outside;
  212. }
  213. ol.arabic {
  214. list-style-type: decimal;
  215. }
  216. ol.loweralpha {
  217. list-style-type: lower-alpha;
  218. }
  219. ol.upperalpha {
  220. list-style-type: upper-alpha;
  221. }
  222. ol.lowerroman {
  223. list-style-type: lower-roman;
  224. }
  225. ol.upperroman {
  226. list-style-type: upper-roman;
  227. }
  228. div.compact ul, div.compact ol,
  229. div.compact p, div.compact p,
  230. div.compact div, div.compact div {
  231. margin-top: 0.1em;
  232. margin-bottom: 0.1em;
  233. }
  234. tfoot {
  235. font-weight: bold;
  236. }
  237. td > div.verse {
  238. white-space: pre;
  239. }
  240. div.hdlist {
  241. margin-top: 0.8em;
  242. margin-bottom: 0.8em;
  243. }
  244. div.hdlist tr {
  245. padding-bottom: 15px;
  246. }
  247. dt.hdlist1.strong, td.hdlist1.strong {
  248. font-weight: bold;
  249. }
  250. td.hdlist1 {
  251. vertical-align: top;
  252. font-style: normal;
  253. padding-right: 0.8em;
  254. color: navy;
  255. }
  256. td.hdlist2 {
  257. vertical-align: top;
  258. }
  259. div.hdlist.compact tr {
  260. margin: 0;
  261. padding-bottom: 0;
  262. }
  263. .comment {
  264. background: yellow;
  265. }
  266. .footnote, .footnoteref {
  267. font-size: 0.8em;
  268. }
  269. span.footnote, span.footnoteref {
  270. vertical-align: super;
  271. }
  272. #footnotes {
  273. margin: 20px 0 20px 0;
  274. padding: 7px 0 0 0;
  275. }
  276. #footnotes div.footnote {
  277. margin: 0 0 5px 0;
  278. }
  279. #footnotes hr {
  280. border: none;
  281. border-top: 1px solid silver;
  282. height: 1px;
  283. text-align: left;
  284. margin-left: 0;
  285. width: 20%;
  286. min-width: 100px;
  287. }
  288. div.colist td {
  289. padding-right: 0.5em;
  290. padding-bottom: 0.3em;
  291. vertical-align: top;
  292. }
  293. div.colist td img {
  294. margin-top: 0.3em;
  295. }
  296. @media print {
  297. #footer-badges { display: none; }
  298. }
  299. #toc {
  300. margin-bottom: 2.5em;
  301. }
  302. #toctitle {
  303. color: #527bbd;
  304. font-size: 1.1em;
  305. font-weight: bold;
  306. margin-top: 1.0em;
  307. margin-bottom: 0.1em;
  308. }
  309. div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
  310. margin-top: 0;
  311. margin-bottom: 0;
  312. }
  313. div.toclevel2 {
  314. margin-left: 2em;
  315. font-size: 0.9em;
  316. }
  317. div.toclevel3 {
  318. margin-left: 4em;
  319. font-size: 0.9em;
  320. }
  321. div.toclevel4 {
  322. margin-left: 6em;
  323. font-size: 0.9em;
  324. }
  325. span.aqua { color: aqua; }
  326. span.black { color: black; }
  327. span.blue { color: blue; }
  328. span.fuchsia { color: fuchsia; }
  329. span.gray { color: gray; }
  330. span.green { color: green; }
  331. span.lime { color: lime; }
  332. span.maroon { color: maroon; }
  333. span.navy { color: navy; }
  334. span.olive { color: olive; }
  335. span.purple { color: purple; }
  336. span.red { color: red; }
  337. span.silver { color: silver; }
  338. span.teal { color: teal; }
  339. span.white { color: white; }
  340. span.yellow { color: yellow; }
  341. span.aqua-background { background: aqua; }
  342. span.black-background { background: black; }
  343. span.blue-background { background: blue; }
  344. span.fuchsia-background { background: fuchsia; }
  345. span.gray-background { background: gray; }
  346. span.green-background { background: green; }
  347. span.lime-background { background: lime; }
  348. span.maroon-background { background: maroon; }
  349. span.navy-background { background: navy; }
  350. span.olive-background { background: olive; }
  351. span.purple-background { background: purple; }
  352. span.red-background { background: red; }
  353. span.silver-background { background: silver; }
  354. span.teal-background { background: teal; }
  355. span.white-background { background: white; }
  356. span.yellow-background { background: yellow; }
  357. span.big { font-size: 2em; }
  358. span.small { font-size: 0.6em; }
  359. span.underline { text-decoration: underline; }
  360. span.overline { text-decoration: overline; }
  361. span.line-through { text-decoration: line-through; }
  362. /*
  363. * xhtml11 specific
  364. *
  365. * */
  366. tt {
  367. font-family: monospace;
  368. font-size: inherit;
  369. color: navy;
  370. }
  371. div.tableblock {
  372. margin-top: 1.0em;
  373. margin-bottom: 1.5em;
  374. }
  375. div.tableblock > table {
  376. border: 3px solid #527bbd;
  377. }
  378. thead, p.table.header {
  379. font-weight: bold;
  380. color: #527bbd;
  381. }
  382. p.table {
  383. margin-top: 0;
  384. }
  385. /* Because the table frame attribute is overriden by CSS in most browsers. */
  386. div.tableblock > table[frame="void"] {
  387. border-style: none;
  388. }
  389. div.tableblock > table[frame="hsides"] {
  390. border-left-style: none;
  391. border-right-style: none;
  392. }
  393. div.tableblock > table[frame="vsides"] {
  394. border-top-style: none;
  395. border-bottom-style: none;
  396. }
  397. /*
  398. * html5 specific
  399. *
  400. * */
  401. .monospaced {
  402. font-family: monospace;
  403. font-size: inherit;
  404. color: navy;
  405. }
  406. table.tableblock {
  407. margin-top: 1.0em;
  408. margin-bottom: 1.5em;
  409. }
  410. thead, p.tableblock.header {
  411. font-weight: bold;
  412. color: #527bbd;
  413. }
  414. p.tableblock {
  415. margin-top: 0;
  416. }
  417. table.tableblock {
  418. border-width: 3px;
  419. border-spacing: 0px;
  420. border-style: solid;
  421. border-color: #527bbd;
  422. border-collapse: collapse;
  423. }
  424. th.tableblock, td.tableblock {
  425. border-width: 1px;
  426. padding: 4px;
  427. border-style: solid;
  428. border-color: #527bbd;
  429. }
  430. table.tableblock.frame-topbot {
  431. border-left-style: hidden;
  432. border-right-style: hidden;
  433. }
  434. table.tableblock.frame-sides {
  435. border-top-style: hidden;
  436. border-bottom-style: hidden;
  437. }
  438. table.tableblock.frame-none {
  439. border-style: hidden;
  440. }
  441. th.tableblock.halign-left, td.tableblock.halign-left {
  442. text-align: left;
  443. }
  444. th.tableblock.halign-center, td.tableblock.halign-center {
  445. text-align: center;
  446. }
  447. th.tableblock.halign-right, td.tableblock.halign-right {
  448. text-align: right;
  449. }
  450. th.tableblock.valign-top, td.tableblock.valign-top {
  451. vertical-align: top;
  452. }
  453. th.tableblock.valign-middle, td.tableblock.valign-middle {
  454. vertical-align: middle;
  455. }
  456. th.tableblock.valign-bottom, td.tableblock.valign-bottom {
  457. vertical-align: bottom;
  458. }
  459. /*
  460. * manpage specific
  461. *
  462. * */
  463. body.manpage h1 {
  464. padding-top: 0.5em;
  465. padding-bottom: 0.5em;
  466. border-top: 2px solid silver;
  467. border-bottom: 2px solid silver;
  468. }
  469. body.manpage h2 {
  470. border-style: none;
  471. }
  472. body.manpage div.sectionbody {
  473. margin-left: 3em;
  474. }
  475. @media print {
  476. body.manpage div#toc { display: none; }
  477. }
  478. </style>
  479. <script type="text/javascript">
  480. /*<![CDATA[*/
  481. var asciidoc = { // Namespace.
  482. /////////////////////////////////////////////////////////////////////
  483. // Table Of Contents generator
  484. /////////////////////////////////////////////////////////////////////
  485. /* Author: Mihai Bazon, September 2002
  486. * http://students.infoiasi.ro/~mishoo
  487. *
  488. * Table Of Content generator
  489. * Version: 0.4
  490. *
  491. * Feel free to use this script under the terms of the GNU General Public
  492. * License, as long as you do not remove or alter this notice.
  493. */
  494. /* modified by Troy D. Hanson, September 2006. License: GPL */
  495. /* modified by Stuart Rackham, 2006, 2009. License: GPL */
  496. // toclevels = 1..4.
  497. toc: function (toclevels) {
  498. function getText(el) {
  499. var text = "";
  500. for (var i = el.firstChild; i != null; i = i.nextSibling) {
  501. if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
  502. text += i.data;
  503. else if (i.firstChild != null)
  504. text += getText(i);
  505. }
  506. return text;
  507. }
  508. function TocEntry(el, text, toclevel) {
  509. this.element = el;
  510. this.text = text;
  511. this.toclevel = toclevel;
  512. }
  513. function tocEntries(el, toclevels) {
  514. var result = new Array;
  515. var re = new RegExp('[hH]([2-'+(toclevels+1)+'])');
  516. // Function that scans the DOM tree for header elements (the DOM2
  517. // nodeIterator API would be a better technique but not supported by all
  518. // browsers).
  519. var iterate = function (el) {
  520. for (var i = el.firstChild; i != null; i = i.nextSibling) {
  521. if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
  522. var mo = re.exec(i.tagName);
  523. if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
  524. result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
  525. }
  526. iterate(i);
  527. }
  528. }
  529. }
  530. iterate(el);
  531. return result;
  532. }
  533. var toc = document.getElementById("toc");
  534. if (!toc) {
  535. return;
  536. }
  537. // Delete existing TOC entries in case we're reloading the TOC.
  538. var tocEntriesToRemove = [];
  539. var i;
  540. for (i = 0; i < toc.childNodes.length; i++) {
  541. var entry = toc.childNodes[i];
  542. if (entry.nodeName == 'div'
  543. && entry.getAttribute("class")
  544. && entry.getAttribute("class").match(/^toclevel/))
  545. tocEntriesToRemove.push(entry);
  546. }
  547. for (i = 0; i < tocEntriesToRemove.length; i++) {
  548. toc.removeChild(tocEntriesToRemove[i]);
  549. }
  550. // Rebuild TOC entries.
  551. var entries = tocEntries(document.getElementById("content"), toclevels);
  552. for (var i = 0; i < entries.length; ++i) {
  553. var entry = entries[i];
  554. if (entry.element.id == "")
  555. entry.element.id = "_toc_" + i;
  556. var a = document.createElement("a");
  557. a.href = "#" + entry.element.id;
  558. a.appendChild(document.createTextNode(entry.text));
  559. var div = document.createElement("div");
  560. div.appendChild(a);
  561. div.className = "toclevel" + entry.toclevel;
  562. toc.appendChild(div);
  563. }
  564. if (entries.length == 0)
  565. toc.parentNode.removeChild(toc);
  566. },
  567. /////////////////////////////////////////////////////////////////////
  568. // Footnotes generator
  569. /////////////////////////////////////////////////////////////////////
  570. /* Based on footnote generation code from:
  571. * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
  572. */
  573. footnotes: function () {
  574. // Delete existing footnote entries in case we're reloading the footnodes.
  575. var i;
  576. var noteholder = document.getElementById("footnotes");
  577. if (!noteholder) {
  578. return;
  579. }
  580. var entriesToRemove = [];
  581. for (i = 0; i < noteholder.childNodes.length; i++) {
  582. var entry = noteholder.childNodes[i];
  583. if (entry.nodeName == 'div' && entry.getAttribute("class") == "footnote")
  584. entriesToRemove.push(entry);
  585. }
  586. for (i = 0; i < entriesToRemove.length; i++) {
  587. noteholder.removeChild(entriesToRemove[i]);
  588. }
  589. // Rebuild footnote entries.
  590. var cont = document.getElementById("content");
  591. var spans = cont.getElementsByTagName("span");
  592. var refs = {};
  593. var n = 0;
  594. for (i=0; i<spans.length; i++) {
  595. if (spans[i].className == "footnote") {
  596. n++;
  597. var note = spans[i].getAttribute("data-note");
  598. if (!note) {
  599. // Use [\s\S] in place of . so multi-line matches work.
  600. // Because JavaScript has no s (dotall) regex flag.
  601. note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
  602. spans[i].innerHTML =
  603. "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
  604. "' title='View footnote' class='footnote'>" + n + "</a>]";
  605. spans[i].setAttribute("data-note", note);
  606. }
  607. noteholder.innerHTML +=
  608. "<div class='footnote' id='_footnote_" + n + "'>" +
  609. "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
  610. n + "</a>. " + note + "</div>";
  611. var id =spans[i].getAttribute("id");
  612. if (id != null) refs["#"+id] = n;
  613. }
  614. }
  615. if (n == 0)
  616. noteholder.parentNode.removeChild(noteholder);
  617. else {
  618. // Process footnoterefs.
  619. for (i=0; i<spans.length; i++) {
  620. if (spans[i].className == "footnoteref") {
  621. var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
  622. href = href.match(/#.*/)[0]; // Because IE return full URL.
  623. n = refs[href];
  624. spans[i].innerHTML =
  625. "[<a href='#_footnote_" + n +
  626. "' title='View footnote' class='footnote'>" + n + "</a>]";
  627. }
  628. }
  629. }
  630. },
  631. install: function(toclevels) {
  632. var timerId;
  633. function reinstall() {
  634. asciidoc.footnotes();
  635. if (toclevels) {
  636. asciidoc.toc(toclevels);
  637. }
  638. }
  639. function reinstallAndRemoveTimer() {
  640. clearInterval(timerId);
  641. reinstall();
  642. }
  643. timerId = setInterval(reinstall, 500);
  644. if (document.addEventListener)
  645. document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false);
  646. else
  647. window.onload = reinstallAndRemoveTimer;
  648. }
  649. }
  650. asciidoc.install(2);
  651. /*]]>*/
  652. </script>
  653. </head>
  654. <body class="article">
  655. <div id="header">
  656. <h1>CSYNC User Guide</h1>
  657. <span id="author">Andreas Schneider</span><br />
  658. <span id="email"><tt>&lt;<a href="mailto:asn@cryptomilk.org">asn@cryptomilk.org</a>&gt;</tt></span><br />
  659. <div id="toc">
  660. <div id="toctitle">Table of Contents</div>
  661. <noscript><p><b>JavaScript must be enabled in your browser to display the table of contents.</b></p></noscript>
  662. </div>
  663. </div>
  664. <div id="content">
  665. <div id="preamble">
  666. <div class="sectionbody">
  667. <div class="paragraph"><p>csync is a lightweight utility to synchronize files between two directories
  668. on a system or between multiple systems.</p></div>
  669. <div class="paragraph"><p>It synchronizes bidirectionally and allows the user to keep two copies of files
  670. and directories in sync. csync uses widely adopted protocols, such as smb or
  671. sftp, so that there is no need for a server component. It is a user-level
  672. program which means you don&#8217;t need to be a superuser or administrator.</p></div>
  673. <div class="paragraph"><p>Together with a Pluggable Authentication Module (PAM), the intent is to provide
  674. Roaming Home Directories for Linux (see <a href="#X80">The PAM Module</a>).</p></div>
  675. </div>
  676. </div>
  677. <div class="sect1">
  678. <h2 id="_introduction">1. Introduction</h2>
  679. <div class="sectionbody">
  680. <div class="paragraph"><p>It is often the case that we have multiple copies (called replicas) of a
  681. filesystem or part of a filesystem (for example on a notebook and desktop
  682. computer). Changes to each replica are often made independently, and as a
  683. result, they do not contain the same information. In that case, a file
  684. synchronizer is used to make them consistent again, without losing any
  685. information.</p></div>
  686. <div class="paragraph"><p>The goal is to detect conflicting updates (files which have been modified) and
  687. propagate non-conflicting updates to each replica. If there are no conflicts
  688. left, we are done, and the replicas are identical. To resolve or handle
  689. conflicts there are several algorithms available. They will be discussed
  690. one of the following sections.</p></div>
  691. </div>
  692. </div>
  693. <div class="sect1">
  694. <h2 id="_basics">2. Basics</h2>
  695. <div class="sectionbody">
  696. <div class="paragraph"><p>This section describes some basics of file synchronization.</p></div>
  697. <div class="sect2">
  698. <h3 id="_paths">2.1. Paths</h3>
  699. <div class="paragraph"><p>A path normally refers to a point which contains a set of files which should be
  700. synchronized. It is specified relative to the root of the replica locally, but
  701. has to be absolute if you use a protocol. The path is just a sequence of names
  702. separated by <em>/</em>.</p></div>
  703. <div class="admonitionblock">
  704. <table><tr>
  705. <td class="icon">
  706. <img src="./images/icons/note.png" alt="Note" />
  707. </td>
  708. <td class="content">The path separator is always a forward slash <em>/</em>, even for Windows.</td>
  709. </tr></table>
  710. </div>
  711. <div class="paragraph"><p>csync always uses the absolute path on remote replicas. This could
  712. <em>sftp://gladiac:secret@myserver/home/gladiac</em> for sftp.</p></div>
  713. </div>
  714. <div class="sect2">
  715. <h3 id="_what_is_an_update">2.2. What is an update?</h3>
  716. <div class="paragraph"><p>The contents of a path could be a file, a directory or a symbolic link
  717. (symbolic links are not supported yet). To be more precise, if the path refers
  718. to:</p></div>
  719. <div class="ulist"><ul>
  720. <li>
  721. <p>
  722. a regular file: the contents of the file are the byte stream and the
  723. metadata of the file.
  724. </p>
  725. </li>
  726. <li>
  727. <p>
  728. a directory: then the content is the metadata of the directory.
  729. </p>
  730. </li>
  731. <li>
  732. <p>
  733. a symbolic link: the content is the named file the link points to.
  734. </p>
  735. </li>
  736. </ul></div>
  737. <div class="paragraph"><p>csync keeps a record of each path which has been successfully synchronized. The
  738. path gets compared with the record and if it has changed since the last
  739. synchronization, we have an update. This is done by comparing the modification
  740. or change (modification time of the metadata) time. This is the way how updates
  741. are detected.</p></div>
  742. </div>
  743. <div class="sect2">
  744. <h3 id="_what_is_a_conflict">2.3. What is a conflict?</h3>
  745. <div class="paragraph"><p>A path is conflicting if it fulfills the following conditions:</p></div>
  746. <div class="olist arabic"><ol class="arabic">
  747. <li>
  748. <p>
  749. it has been updated in one replica,
  750. </p>
  751. </li>
  752. <li>
  753. <p>
  754. it or any of its descendants has been updated on the other replica too, and
  755. </p>
  756. </li>
  757. <li>
  758. <p>
  759. its contents in are not identical.
  760. </p>
  761. </li>
  762. </ol></div>
  763. </div>
  764. </div>
  765. </div>
  766. <div class="sect1">
  767. <h2 id="_file_synchronization">3. File Synchronization</h2>
  768. <div class="sectionbody">
  769. <div class="paragraph"><p>The primary goal of the file synchronizer is correctness. It may change
  770. scattered or large parts of the filesystem. Since this in mostly not monitored
  771. by the user, and the file synchronizer is in a position to harm the system,
  772. csync must be safe, even in the case of unexpected errors (e.g. disk full).
  773. What was done to make csync safe is described in the following sections.</p></div>
  774. <div class="paragraph"><p>One problem concerning correctness is the handling of conflicts. Each file
  775. synchronizer tries to propagate conflicting changes to the other replica. At
  776. the end both replicas should be identical. There are different strategies to
  777. fulfill these goals.</p></div>
  778. <div class="paragraph"><p>csync is a three-phase file synchronizer. The decision for this design was that
  779. user interaction should be possible and it should be easy to understand the
  780. process. The three phases are update detection, reconciliation and propagation.
  781. These will be described in the following sections.</p></div>
  782. <div class="sect2">
  783. <h3 id="_update_detection">3.1. Update detection</h3>
  784. <div class="paragraph"><p>There are different strategies for update detection. csync uses a state-based
  785. modtime-inode update detector. This means it uses the modification time to
  786. detect updates. It doesn&#8217;t require many resources. A record of each file is
  787. stored in a database (called statedb) and compared with the current
  788. modification time during update detection. If the file has changed since the
  789. last synchronization an instruction is set to evaluate it during the
  790. reconciliation phase. If we don&#8217;t have a record for a file we investigate, it
  791. is marked as new.</p></div>
  792. <div class="paragraph"><p>It can be difficult to detect renaming of files. This problem is also solved
  793. by the record we store in the statedb. If we don&#8217;t find the file by the name
  794. in the database, we search for the inode number. If the inode number is found
  795. then the file has been renamed.</p></div>
  796. </div>
  797. <div class="sect2">
  798. <h3 id="_reconciliation">3.2. Reconciliation</h3>
  799. <div class="paragraph"><p>The most important component is the update detector, because the reconciler
  800. depends on it. The correctness of reconciler is mandatory because it can damage
  801. a filesystem. It decides which file:</p></div>
  802. <div class="ulist"><ul>
  803. <li>
  804. <p>
  805. Stays untouched
  806. </p>
  807. </li>
  808. <li>
  809. <p>
  810. Has a conflict
  811. </p>
  812. </li>
  813. <li>
  814. <p>
  815. Gets synchronized
  816. </p>
  817. </li>
  818. <li>
  819. <p>
  820. or is <strong>deleted</strong>
  821. </p>
  822. </li>
  823. </ul></div>
  824. <div class="paragraph"><p>A wrong decision of the reconciler leads in most cases to a loss of data. So
  825. there are several conditions which a file synchronizer has to follow.</p></div>
  826. <div class="sect3">
  827. <h4 id="_algorithms">3.2.1. Algorithms</h4>
  828. <div class="paragraph"><p>For conflict resolution several different algorithms could be implemented. The
  829. most common algorithms are the merge and the conflict algorithm. The first
  830. is a batch algorithm and the second is one which needs user interaction.</p></div>
  831. <div class="sect4">
  832. <h5 id="_merge_algorithm">Merge algorithm</h5>
  833. <div class="paragraph"><p>The merge algorithm is an algorithm which doesn&#8217;t need any user interaction. It
  834. is simple and used for example by Microsoft for Roaming Profiles. If it detects
  835. a conflict (the same file changed on both replicas) then it will use the most
  836. recent file and overwrite the other. This means you can loose some data, but
  837. normally you want the latest file.</p></div>
  838. </div>
  839. <div class="sect4">
  840. <h5 id="_conflict_algorithm">Conflict algorithm</h5>
  841. <div class="paragraph"><p>This is not implemented yet.</p></div>
  842. <div class="paragraph"><p>If a file has a conflict the user has to decide which file should be used.</p></div>
  843. </div>
  844. </div>
  845. </div>
  846. <div class="sect2">
  847. <h3 id="_propagation">3.3. Propagation</h3>
  848. <div class="paragraph"><p>The next instance of the file synchronizer is the propagator. It uses the
  849. calculated records to apply them on the current replica.</p></div>
  850. <div class="paragraph"><p>The propagator uses a two-phase-commit mechanism to simulate an atomic
  851. filesystem operation.</p></div>
  852. <div class="paragraph"><p>In the first phase we copy the file to a temporary file on the opposite
  853. replica. This has the advantage that we can check if the file which has been
  854. copied to the opposite replica has been transferred successfully. If the
  855. connection gets interrupted during the transfer we still have the original
  856. states of the file. This means no data will be lost.</p></div>
  857. <div class="paragraph"><p>In the second phase the file on the opposite replica will be overwritten by
  858. the temporary file.</p></div>
  859. <div class="paragraph"><p>After a successful propagation we have to merge the trees to reflect the
  860. current state of the filesystem tree. This updated tree will be written as a
  861. journal into the state database. It will be used during the update detection of
  862. the next synchronization. See above for a description of the state database
  863. during synchronization.</p></div>
  864. </div>
  865. <div class="sect2">
  866. <h3 id="_robustness">3.4. Robustness</h3>
  867. <div class="paragraph"><p>This is a very important topic. The file synchronizer should not crash, and if
  868. it has crashed, there should be no loss of data. To achieve this goal there are
  869. several mechanisms which will be discussed in the following sections.</p></div>
  870. <div class="sect3">
  871. <h4 id="_crash_resistance">3.4.1. Crash resistance</h4>
  872. <div class="paragraph"><p>The synchronization process can be interrupted by different events, this can
  873. be:</p></div>
  874. <div class="ulist"><ul>
  875. <li>
  876. <p>
  877. the system could be halted due to errors.
  878. </p>
  879. </li>
  880. <li>
  881. <p>
  882. the disk could be full or the quota exceeded.
  883. </p>
  884. </li>
  885. <li>
  886. <p>
  887. the network or power cable could be pulled out.
  888. </p>
  889. </li>
  890. <li>
  891. <p>
  892. the user could force a stop of the synchronization process.
  893. </p>
  894. </li>
  895. <li>
  896. <p>
  897. various communication errors could occur.
  898. </p>
  899. </li>
  900. </ul></div>
  901. <div class="paragraph"><p>That no data will be lost due to an event we enforce the following invariant:</p></div>
  902. <div class="admonitionblock">
  903. <table><tr>
  904. <td class="icon">
  905. <img src="./images/icons/important.png" alt="Important" />
  906. </td>
  907. <td class="content">At every moment of the synchronization each file, has either its
  908. original content or its correct final content.</td>
  909. </tr></table>
  910. </div>
  911. <div class="paragraph"><p>This means that the original content can not be incorrect, no data can be lost
  912. until we overwrite it after a successful synchronization. Therefore, each
  913. interrupted synchronization process is a partial sync and can be continued and
  914. completed by simply running csync again. The only problem could be an error of
  915. the filesystem, so we reach this invariant only approximately.</p></div>
  916. </div>
  917. <div class="sect3">
  918. <h4 id="_transfer_errors">3.4.2. Transfer errors</h4>
  919. <div class="paragraph"><p>With the Two-Phase-Commit we check the file size after the file has transferred
  920. and we are able to detect transfer errors. A more robust approach would be a
  921. transfer protocol with checksums, but this is not doable at the moment. We may
  922. add this in the future.</p></div>
  923. <div class="paragraph"><p>Future filesystems, like btrfs, will help to compare checksums instead of the
  924. filesize. This will make the synchronization safer. This does not imply that it
  925. is unsafe now, but checksums are safer than simple filesize checks.</p></div>
  926. </div>
  927. <div class="sect3">
  928. <h4 id="_database_loss">3.4.3. Database loss</h4>
  929. <div class="paragraph"><p>It is possible that the state database could get corrupted. If this happens,
  930. all files get evaluated. In this case the file synchronizer wont delete any
  931. file, but it could occur that deleted files will be restored from the other
  932. replica.</p></div>
  933. <div class="paragraph"><p>To prevent a corruption or loss of the database if an error occurs or the user
  934. forces an abort, the synchronizer is working on a copy of the database and will
  935. use a Two-Phase-Commit to save it at the end.</p></div>
  936. </div>
  937. </div>
  938. </div>
  939. </div>
  940. <div class="sect1">
  941. <h2 id="_getting_started">4. Getting started</h2>
  942. <div class="sectionbody">
  943. <div class="sect2">
  944. <h3 id="_installing_csync">4.1. Installing csync</h3>
  945. <div class="paragraph"><p>See the <tt>README</tt> and <tt>INSTALL</tt> files for install prerequisites and
  946. procedures. Packagers should take a look at <a href="#X90">Appendix A: Packager Notes</a>.</p></div>
  947. </div>
  948. <div class="sect2">
  949. <h3 id="_using_the_commandline_client">4.2. Using the commandline client</h3>
  950. <div class="paragraph"><p>The synopsis of the commandline client is</p></div>
  951. <div class="literalblock">
  952. <div class="content">
  953. <pre><tt>csync [OPTION...] SOURCE DESTINATION</tt></pre>
  954. </div></div>
  955. <div class="paragraph"><p>It synchronizes the content of SOURCE with DESTINATION and vice versa. The
  956. DESTINATION can be a local directory or a remote file server.</p></div>
  957. <div class="literalblock">
  958. <div class="content">
  959. <pre><tt>csync /home/csync scheme://user:password@server:port/full/path</tt></pre>
  960. </div></div>
  961. <div class="sect3">
  962. <h4 id="_examples">4.2.1. Examples</h4>
  963. <div class="paragraph"><p>To synchronize two local directories:</p></div>
  964. <div class="literalblock">
  965. <div class="content">
  966. <pre><tt>csync /home/csync/replica1 /home/csync/relplica2</tt></pre>
  967. </div></div>
  968. <div class="paragraph"><p>Two synchronizer a local directory with an smb server, use</p></div>
  969. <div class="literalblock">
  970. <div class="content">
  971. <pre><tt>csync /home/csync smb://rupert.galaxy.site/Users/csync</tt></pre>
  972. </div></div>
  973. <div class="paragraph"><p>If you use kerberos, you don&#8217;t have to specify a username or a password. If you
  974. don&#8217;t use kerberos, the commandline client will ask about the user and the
  975. password. If you don&#8217;t want to be prompted, you can specify it on the
  976. commandline:</p></div>
  977. <div class="literalblock">
  978. <div class="content">
  979. <pre><tt>csync /home/csync smb://csync:secret@rupert.galaxy.site/Users/csync</tt></pre>
  980. </div></div>
  981. <div class="paragraph"><p>If you use the sftp protocol and want to specify a port, you do it the
  982. following way:</p></div>
  983. <div class="literalblock">
  984. <div class="content">
  985. <pre><tt>csync /home/csync sftp://csync@krikkit.galaxy.site:2222/home/csync</tt></pre>
  986. </div></div>
  987. <div class="paragraph"><p>The remote destination is supported by plugins. By default csync ships with smb
  988. and sftp support. For more information, see the manpage of <tt>csync(1)</tt>.</p></div>
  989. </div>
  990. </div>
  991. <div class="sect2">
  992. <h3 id="_exclude_lists">4.3. Exclude lists</h3>
  993. <div class="paragraph"><p>csync provides exclude lists with simple shell wildcard patterns. There is a
  994. global exclude list, which is normally located in
  995. <em>/etc/csync/csync_exclude.conf</em> and it has already some sane defaults. If you
  996. run csync the first time, it will create an empty exclude list for the user.
  997. This file will be <em>~/.csync/csync_exclude.conf</em>. csync considers both
  998. configuration files and an additional one if you specify it.</p></div>
  999. <div class="paragraph"><p>The entries in the file are newline separated. Use
  1000. <em>/etc/csync/csync_exclude.conf</em> as an example.</p></div>
  1001. </div>
  1002. <div class="sect2">
  1003. <h3 id="_debug_messages_and_dry_run">4.4. Debug messages and dry run</h3>
  1004. <div class="paragraph"><p>By default the csync client logs to stderr and you can increase the debug
  1005. level with a commandline options.</p></div>
  1006. <div class="paragraph"><p>To simulate a run of the file synchronizer, you should set the priority to
  1007. <em>debug</em> for the categories <em>csync.updater</em> and <em>csync.reconciler</em> in the config
  1008. file <em>~/.csync/csync_log.conf</em>. Then run csync with the <em>--dry-run</em> option.
  1009. This will only run update detection and reconciliation.</p></div>
  1010. </div>
  1011. <div class="sect2">
  1012. <h3 id="X80">4.5. The PAM module</h3>
  1013. <div class="paragraph"><p>pam_csync is a PAM module to provide roaming home directories for a user
  1014. session. This module is aimed at environments with central file servers where a
  1015. user wishes to store his home directory. The Authentication Module verifies the
  1016. identity of a user and triggers a synchronization with the server on the first
  1017. login and the last logout. More information can be found in the manpage of the
  1018. module pam_csync(8) or pam itself pam(8).</p></div>
  1019. </div>
  1020. </div>
  1021. </div>
  1022. <div class="sect1">
  1023. <h2 id="X90">5. Appendix A: Packager Notes</h2>
  1024. <div class="sectionbody">
  1025. <div class="paragraph"><p>Read the <tt>README</tt>, <tt>INSTALL</tt> and <tt>FAQ</tt> files (in the distribution root
  1026. directory).</p></div>
  1027. </div>
  1028. </div>
  1029. </div>
  1030. <div id="footnotes"><hr /></div>
  1031. <div id="footer">
  1032. <div id="footer-text">
  1033. Last updated 2012-10-29 12:05:41 CET
  1034. </div>
  1035. </div>
  1036. </body>
  1037. </html>