docs/html/introduction.html

Thu, 31 Aug 2017 13:10:55 +0200

author
Mike Becker <universe@uap-core.de>
date
Thu, 31 Aug 2017 13:10:55 +0200
changeset 290
1e3e374d9386
parent 285
02d3e4b1245f
child 320
12ed560c926c
permissions
-rw-r--r--

adds clean handling in case the stack of dav_exec_expr() runs out of memory

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="Content-Style-Type" content="text/css" />
  <meta name="generator" content="pandoc" />
  <title>Introduction to dav-sync</title>
  <style type="text/css">code{white-space: pre;}</style>
  <link rel="stylesheet" href="davdoc.css" type="text/css" />
</head>
<body>
<div class="header">
	<a href="./index.html"><span>DavUtils documentation</span></a>
</div>
<div class="sidebar">
	<div class="nav">
		<h3>dav</h3>
			<ul>
				<li><a href="getting-started.html">Getting started</a></li>
				<li><a href="commands.html">Commands</a></li>
					<ul>
						<li><a href="list.html">list</a></li>
						<li><a href="get.html">get</a></li>
						<li><a href="put.html">put</a></li>
						<li><a href="mkdir.html">mkdir</a></li>
						<li><a href="remove.html">remove</a></li>
						<li><a href="copy.html">copy</a></li>
						<li><a href="move.html">move</a></li>
						<li><a href="get-property.html">get-property</a></li>
						<li><a href="set-property.html">set-property</a></li>
						<li><a href="lock.html">lock</a></li>
						<li><a href="unlock.html">unlock</a></li>
						<li><a href="info.html">info</a></li>
						<li><a href="date.html">date</a></li>
						<li><a href="add-repository.html">add-repository</a></li>
						<li><a href="list-repositories.html">list-repositories</a></li>
						<li><a href="check-config.html">check-config</a></li>
					</ul>
				<li><a href="configuration.html">Configuration</a></li>
				<li><a href="encryption.html">Encryption</a></li>
			</ul>
	</div>
	<div class="nav">
		<h3>dav-sync</h3>
			<ul>
				<li><a href="introduction.html">Introduction</a></li>
				<li><a href="sync-commands.html">Commands</a></li>
					<ul>
						<li><a href="pull.html">pull</a></li>
						<li><a href="push.html">push</a></li>
						<li><a href="resolve-conflicts.html">resolve-conflicts</a></li>
						<li><a href="delete-conflicts.html">delete-conflicts</a></li>
						<li><a href="trash-info.html">trash-info</a></li>
						<li><a href="empty-trash.html">empty-trash</a></li>
						<li><a href="add-directory.html">add-directory</a></li>
						<li><a href="list-directories.html">list-directories</a></li>
						<li><a href="sync-check-config.html">check-config</a></li>
						<li><a href="check-repositories.html">check-repositories</a></li>
					</ul>
				<li><a href="sync-configuration.html">Configuration</a></li>
			</ul>
	</div>
</div>

<!-- begin content -->
<div class="content">
<div id="header">
<h1 class="title">Introduction to dav-sync</h1>
</div>
<p>The dav-sync program can synchronize a local directory with a WebDAV collection.</p>
<h2 id="first-steps">First Steps</h2>
<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>
<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>
<pre><code>$ dav add-repository
Each repository must have an unique name.
name: myfirstrepo

Specify the repository base url.
url: http://example.com/webdav/

User for HTTP authentication.
user (optional): myuser
password (optional): </code></pre>
<p>After the repository is created, configure a sync-directory with <a href="./add-directory.html">dav-sync add-directory</a>.</p>
<pre><code>$ dav-sync add-directory
Each sync directory must have an unique name.
name: mysyncdir
Enter local directory path.
path: $HOME/important_files
Specify webdav repository.
0) myfirstrepo
1) anotherrepo
repository: 0
Enter collection relative to the repository base url.
collection (default: /): /important_files</code></pre>
<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>
<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>
<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>
<p>You can run the <em>pull</em> command with:</p>
<pre><code>dav-sync pull mysyncdir</code></pre>
<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>
<pre><code>dav-sync push mysyncdir</code></pre>
<h2 id="database">Database</h2>
<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>
<h2 id="conflict-detection">Conflict detection</h2>
<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>
<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>
<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>
<h2 id="trash">Trash</h2>
<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>
<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>
<pre><code>&lt;directory&gt;
    &lt;name&gt;mydir&lt;/name&gt;
    &lt;path&gt;$HOME/myfiles&lt;/path&gt;
    &lt;repository&gt;myrepo&lt;/repository&gt;
    &lt;database&gt;mydir-db.xml&lt;/database&gt;
    
    &lt;!-- enable trash dir --&gt;
    &lt;trash&gt;.trash&lt;/trash&gt;
&lt;/directory&gt;</code></pre>
<p>Files inside the trash directory will not be synchronized with the server.</p>
<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>
<pre><code>&lt;directory&gt;
    ...
    
    &lt;backup-on-pull&gt;true&lt;/backup-on-pull&gt;
&lt;directory&gt;</code></pre>
<h2 id="locking">Locking</h2>
<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>
<pre><code>&lt;directory&gt;
    ...
    &lt;lock-pull&gt;true&lt;/lock-pull&gt;
    &lt;lock-push&gt;true&lt;/lock-push&gt;
&lt;/directory&gt;</code></pre>
<p>See <a href="./configuration.html">Configuration</a> for details.</p>
<h2 id="encryption">Encryption</h2>
<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>
</div>
<!-- end content -->
</body>
</html>

mercurial