docs/html/introduction.html

changeset 283
0e36bb75a732
parent 273
c743721d566f
child 285
02d3e4b1245f
equal deleted inserted replaced
282:3070d72f54af 283:0e36bb75a732
2 <html xmlns="http://www.w3.org/1999/xhtml"> 2 <html xmlns="http://www.w3.org/1999/xhtml">
3 <head> 3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <meta http-equiv="Content-Style-Type" content="text/css" /> 5 <meta http-equiv="Content-Style-Type" content="text/css" />
6 <meta name="generator" content="pandoc" /> 6 <meta name="generator" content="pandoc" />
7 <title></title> 7 <title>Introduction to dav-sync</title>
8 <style type="text/css">code{white-space: pre;}</style> 8 <style type="text/css">code{white-space: pre;}</style>
9 <link rel="stylesheet" href="davdoc.css" type="text/css" /> 9 <link rel="stylesheet" href="davdoc.css" type="text/css" />
10 </head> 10 </head>
11 <body> 11 <body>
12 <div class="header"> 12 <div class="header">
62 </div> 62 </div>
63 </div> 63 </div>
64 64
65 <!-- begin content --> 65 <!-- begin content -->
66 <div class="content"> 66 <div class="content">
67 <div id="header">
68 <h1 class="title">Introduction to dav-sync</h1>
69 </div>
70 <p>The dav-sync program can synchronize a local directory with a WebDAV collection.</p>
71 <h2 id="first-steps">First Steps</h2>
72 <p>To use dav-sync it is required to configure a repository in <a href="./configuration.html">config.xml</a> and the directory in <a href="./sync-configuration.html">sync.xml</a>.</p>
73 <p>Create a repository with <a href="./add-repository.html">dav add-repository</a>. Unlike <em>dav</em>, <em>dav-sync</em> is not interactive and never shows an authentication prompt. Therefore the user and password <strong>must</strong> be specified if the server requires authentication.</p>
74 <pre><code>$ dav add-repository
75 Each repository must have an unique name.
76 name: myfirstrepo
67 77
78 Specify the repository base url.
79 url: http://example.com/webdav/
80
81 User for HTTP authentication.
82 user (optional): myuser
83 password (optional): </code></pre>
84 <p>After the repository is created, configure a sync-directory with <a href="./add-directory.html">dav-sync add-directory</a>.</p>
85 <pre><code>$ dav-sync add-directory
86 Each sync directory must have an unique name.
87 name: mysyncdir
88 Enter local directory path.
89 path: $HOME/important_files
90 Specify webdav repository.
91 0) myfirstrepo
92 1) anotherrepo
93 repository: 0
94 Enter collection relative to the repository base url.
95 collection (default: /): /important_files</code></pre>
96 <p>The specified name is just an identifier and will be used with other dav-sync commands like <em>pull</em> and <em>push</em>.</p>
97 <p>After the configuration is created, you can synchronize your files. There are two commands for it: <em>pull</em> and <em>push</em>.</p>
98 <p>With <em>pull</em> you can apply all changes on the server to your local directory. The command scans the server and detects modified files and which files are deleted. All modified files will be downloadet and all deleted files will be locally removed (or moved to the trash directory). The first time you will run <em>pull</em> for a directory this will just download all files from the WebDAV collection.</p>
99 <p>You can run the <em>pull</em> command with:</p>
100 <pre><code>dav-sync pull mysyncdir</code></pre>
101 <p>The <em>push</em> command scans your local directory for changes, uploads all modified files and removes all locally deleted files from the server.</p>
102 <pre><code>dav-sync push mysyncdir</code></pre>
103 <h2 id="database">Database</h2>
104 <p>Every sync-directory has a database xml file that contains the etag and last modified date of each file. The etag is used to detect changes on the server and the last modified date is used to detect local changes. The database file is usually located in <em>$HOME/.dav/</em> and if you want to reset a sync-directory, you can delete the database. After that, <em>pull</em>/<em>push</em> (with disabled conflict detection) will download/upload all files.</p>
105 <h2 id="conflict-detection">Conflict detection</h2>
106 <p>The <em>pull</em> and <em>push</em> commands detect if a file has changed remotely and locally. This is a conflict that must be resolved manually.</p>
107 <p>When <em>pull</em> detects a conflict it renames the local file to <em>orig-$number.$name</em> where <em>$number</em> is an integer, usually 0 if no other conflict file with the name exists and <em>$name</em> is the file's name. After the file is renamed the new file from the server is downloadet. The user should merge the files manually then or just delete one or keep both. After that run <em>resolve-conflicts</em> to remove all conflict entries from the database otherwise <em>push</em> will ignore any file in a conflict state. There is also the <em>delete-conflicts</em> command that deletes all conflict files.</p>
108 <p>When <em>push</em> detects that a file is modified locally and on the server, it just skips this file. Run the <em>pull</em> command to get the new file from the server and resolve the conflict like described above.</p>
109 <h2 id="trash">Trash</h2>
110 <p>For high data safety, a trash directory can be configured. If this is done, dav-sync will not delete files, but move them to the trash directory. Also the pull command can move files to the trash directory before overwriting them.</p>
111 <p>To enable the trash, add the <code>&lt;trash&gt;</code> element to the directory config. The trash path can be absolute or relative to the sync-directory path.</p>
112 <pre><code>&lt;directory&gt;
113 &lt;name&gt;mydir&lt;/name&gt;
114 &lt;path&gt;$HOME/myfiles&lt;/path&gt;
115 &lt;repository&gt;myrepo&lt;/repository&gt;
116 &lt;database&gt;mydir-db.xml&lt;/database&gt;
117
118 &lt;!-- enable trash dir --&gt;
119 &lt;trash&gt;.trash&lt;/trash&gt;
120 &lt;/directory&gt;</code></pre>
121 <p>Files inside the trash directory will not be synchronized with the server.</p>
122 <p>Add the <code>&lt;backup-on-pull&gt;</code> element if you want to backup files to the trash directory before they are overwritten.</p>
123 <pre><code>&lt;directory&gt;
124 ...
125
126 &lt;backup-on-pull&gt;true&lt;/backup-on-pull&gt;
127 &lt;directory&gt;</code></pre>
128 <h2 id="locking">Locking</h2>
129 <p>It is highly recommended to lock the repository if it is expected that multiple users want to access and modify the repository simultaneously. Locking can be enabled with the <code>-l</code> option when using the <em>pull</em> or <em>push</em> command, or it can be permanently enabled in <em>sync.xml</em> for a directory with the <code>&lt;lock-pull&gt;</code> and <code>&lt;lock-push&gt;</code> elements.</p>
130 <pre><code>&lt;directory&gt;
131 ...
132 &lt;lock-pull&gt;true&lt;/lock-pull&gt;
133 &lt;lock-push&gt;true&lt;/lock-push&gt;
134 &lt;/directory&gt;</code></pre>
135 <p>See <a href="./configuration.html">Configuration</a> for details.</p>
136 <h2 id="encryption">Encryption</h2>
137 <p>The <em>dav-sync</em> program uses the same repository settings as <em>dav</em>. If encryption is enabled for a repository, <em>dav-sync</em> stores files encrypted on the server. See <a href="./encryption.html">Encryption</a> for details.</p>
68 </div> 138 </div>
69 <!-- end content --> 139 <!-- end content -->
70 </body> 140 </body>
71 </html> 141 </html>

mercurial