<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>johker&#039;s blog &#187; rsync</title>
	<atom:link href="http://johker.ibutho.de/tag/rsync/feed/" rel="self" type="application/rss+xml" />
	<link>http://johker.ibutho.de</link>
	<description>stories about me, my life and my trips</description>
	<lastBuildDate>Sun, 18 Dec 2011 11:53:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Der neue Server: Teil 9 Backup</title>
		<link>http://johker.ibutho.de/2009/08/02/der-neue-server-teil-9-backup/</link>
		<comments>http://johker.ibutho.de/2009/08/02/der-neue-server-teil-9-backup/#comments</comments>
		<pubDate>Sun, 02 Aug 2009 15:05:25 +0000</pubDate>
		<dc:creator>johker</dc:creator>
				<category><![CDATA[Howto]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[c't]]></category>
		<category><![CDATA[duplicity]]></category>
		<category><![CDATA[ftp]]></category>
		<category><![CDATA[ftplicity]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[postgres]]></category>
		<category><![CDATA[rsync]]></category>

		<guid isPermaLink="false">http://johker.ibutho.de/?p=261</guid>
		<description><![CDATA[Der Server ist zwar nicht mehr neu, aber dieser Beitrag ist evtl. dennoch für einige hilfreich. Deshalb: Viel Spaß! Heute widme ich mich dem Thema Backup. Das habe ich viel zu stark vernachlässigt und will das jetzt nachholen. Das Tool &#8230; <a href="http://johker.ibutho.de/2009/08/02/der-neue-server-teil-9-backup/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Der Server ist zwar nicht mehr neu, aber dieser Beitrag ist evtl. dennoch für einige hilfreich. Deshalb: Viel Spaß!</p>
<p>Heute widme ich mich dem Thema Backup. Das habe ich viel zu stark vernachlässigt und will das jetzt nachholen. Das Tool der Wahl ist <strong><em>duplicity</em></strong> mit dem c&#8217;t Wrapper-Skript <strong><em>ftplicity</em></strong>. Duplicity benutzt unter der Decke <em>rsync</em> zur Erkennung der Deltas. Das Skript wird so konfiguriert, dass es täglich ein inkrementelles Backup macht und monatlich ein volles Backup und dabei die alten Backups löscht. Während des Backup-Prozesses werden auch Backups der MySQL- und postgreSQL-Datenbanken mit den mitgelieferten Tools erstellt (nicht einfach durch Kopieren der Datenbankdateien, da man dabei einen inkonsistenten Zustand erwischen könnte und die Datenbank unbrauchbar ist).</p>
<h1>Installation</h1>
<p>Zuerst die Installation der benötigten Pakete:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> duplicity ncftp
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>downloads.sourceforge.net<span style="color: #000000; font-weight: bold;">/</span>project<span style="color: #000000; font-weight: bold;">/</span>ftplicity<span style="color: #000000; font-weight: bold;">/</span>ftplicity<span style="color: #000000; font-weight: bold;">/</span>1.5.0.2<span style="color: #000000; font-weight: bold;">/</span>ftplicity_1.5.0.2.tgz?<span style="color: #007800;">use_mirror</span>=switch
<span style="color: #c20cb9; font-weight: bold;">tar</span> xvfz ftplicity_1.5.0.2.tgz
<span style="color: #c20cb9; font-weight: bold;">mv</span> ftplicity_1.5.0.2<span style="color: #000000; font-weight: bold;">/</span>ftplicity <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">chown</span> root: <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ftplicity
<span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">755</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ftplicity</pre></td></tr></table></div>

<h1>Konfiguration</h1>
<h2>Erstellung eines GPG-Schlüssel für Backups</h2>
<p>Da <em>ftplicity</em> Backups automatisch verschlüsselt ablegt, ist es nötig einen GPG-Schlüssel zu erstellen:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">gpg <span style="color: #660033;">--gen-key</span></pre></td></tr></table></div>

<p><code><br />
root@domain.tld:~# gpg --gen-key<br />
gpg (GnuPG) 1.4.9; Copyright (C) 2008 Free Software Foundation, Inc.<br />
This is free software: you are free to change and redistribute it.<br />
There is NO WARRANTY, to the extent permitted by law.</p>
<p>gpg: keyring `/root/.gnupg/secring.gpg' created<br />
Please select what kind of key you want:<br />
   (1) DSA and Elgamal (default)<br />
   (2) DSA (sign only)<br />
   (5) RSA (sign only)<br />
Your selection? <-- ENTER<br />
DSA keypair will have 1024 bits.<br />
ELG-E keys may be between 1024 and 4096 bits long.<br />
What keysize do you want? (2048) <-- ENTER<br />
Requested keysize is 2048 bits<br />
Please specify how long the key should be valid.<br />
         0 = key does not expire<br />
      <n>  = key expires in n days<br />
      <n>w = key expires in n weeks<br />
      <n>m = key expires in n months<br />
      <n>y = key expires in n years<br />
Key is valid for? (0) <-- ENTER<br />
Key does not expire at all<br />
Is this correct? (y/N) <-- y</p>
<p>You need a user ID to identify your key; the software constructs the user ID<br />
from the Real Name, Comment and Email Address in this form:<br />
    "Heinrich Heine (Der Dichter) <heinrichh@duesseldorf.de>"</p>
<p>Real name: Musterserver Backup<br />
Email address: backup@domain.tld<br />
Comment: Key for System Backups on domain.tld<br />
You selected this USER-ID:<br />
    "domain.tld Backup (Key for System Backups on domain.tld) <backup@domain.tld>"</p>
<p>Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? <-- O<br />
You need a Passphrase to protect your secret key.</p>
<p>Enter passphrase: <-- Passwort eingeben<br />
We need to generate a lot of random bytes. It is a good idea to perform<br />
some other action (type on the keyboard, move the mouse, utilize the<br />
disks) during the prime generation; this gives the random number<br />
generator a better chance to gain enough entropy.<br />
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.+++++++++++++++.+++++++++++++++.++++++++++++++++++++.+++++..+++++++++++++++>++++++++++>.+++++...........<+++++>+++++..<.+++++.....................................................>.+++++.....+++++</p>
<p>gpg: /root/.gnupg/trustdb.gpg: trustdb created<br />
gpg: key 123ABC45 marked as ultimately trusted<br />
public and secret key created and signed.</p>
<p>...<br />
</code></p>
<p>Die achtstellige ID (im Beispiel <strong>123ABC45</strong>) bitte merken, da diese später benötigt wird. Ebenso das Passwort.</p>
<p>Danach legen exportieren wir noch unsere Schlüssel (public/private), damit wir diese an einem sicheren Ort speichern können, damit unsere Daten nicht verloren gehen, sollte die Festplatte sich verabschieden:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">root<span style="color: #000000; font-weight: bold;">@</span>domain.tld:~<span style="color: #000000; font-weight: bold;">/</span>gpg-key<span style="color: #666666; font-style: italic;"># gpg --output backup_pub.gpg --armor --export 123ABC45</span>
root<span style="color: #000000; font-weight: bold;">@</span>domain.tld:~<span style="color: #000000; font-weight: bold;">/</span>gpg-key<span style="color: #666666; font-style: italic;"># gpg --output backup_sec.gpg --armor --export-secret-key 123ABC45</span></pre></td></tr></table></div>

<h2>ftplicity</h2>
<p>Nun starten wir ftplicity einmal, damit eine Standardkonfiguration angelegt wird, die wir an unsere Wünsche anpassen können:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">ftplicity system create</pre></td></tr></table></div>

<p>Nun editieren wir die Datei &#8220;<em>/root/.ftplicity/system/conf</em>&#8220;:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># gpg key data (for symmetric encryption comment out GPG_KEY)</span>
<span style="color: #007800;">GPG_KEY</span>=<span style="color: #ff0000;">'123ABC45'</span>
<span style="color: #007800;">GPG_PW</span>=<span style="color: #ff0000;">'PASSWORD'</span>
<span style="color: #666666; font-style: italic;"># gpg options passed from duplicity to gpg process (default='')</span>
<span style="color: #666666; font-style: italic;"># e.g. &quot;--trust-model pgp|classic|direct|always&quot; </span>
<span style="color: #666666; font-style: italic;">#   or &quot;--compress-algo=bzip2 --bzip2-compress-level=9&quot;</span>
<span style="color: #666666; font-style: italic;">#GPG_OPTS=''</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># credentials &amp; server address of the backup target (URL-Format)</span>
<span style="color: #666666; font-style: italic;"># syntax is</span>
<span style="color: #666666; font-style: italic;">#   scheme://user[:password]@host[:port]/[/]path</span>
<span style="color: #666666; font-style: italic;"># probably one out of</span>
<span style="color: #666666; font-style: italic;">#   file:///some_dir</span>
<span style="color: #666666; font-style: italic;">#   ftp://user[:password]@other.host[:port]/some_dir</span>
<span style="color: #666666; font-style: italic;">#   hsi://user[:password]@other.host/some_dir</span>
<span style="color: #666666; font-style: italic;">#   cf+http://container_name</span>
<span style="color: #666666; font-style: italic;">#   imap://user[:password]@host.com[/from_address_prefix]</span>
<span style="color: #666666; font-style: italic;">#   imaps://user[:password]@host.com[/from_address_prefix]</span>
<span style="color: #666666; font-style: italic;">#   rsync://user[:password]@other.host[:port]::/module/some_dir</span>
<span style="color: #666666; font-style: italic;">#   rsync://user[:password]@other.host[:port]/relative_path</span>
<span style="color: #666666; font-style: italic;">#   rsync://user[:password]@other.host[:port]//absolute_path</span>
<span style="color: #666666; font-style: italic;">#   s3://host/bucket_name[/prefix]</span>
<span style="color: #666666; font-style: italic;">#   s3+http://bucket_name[/prefix]</span>
<span style="color: #666666; font-style: italic;">#   scp://user[:password]@other.host[:port]/some_dir</span>
<span style="color: #666666; font-style: italic;">#   ssh://user[:password]@other.host[:port]/some_dir</span>
<span style="color: #666666; font-style: italic;">#   tahoe://alias/directory</span>
<span style="color: #666666; font-style: italic;">#   webdav://user[:password]@other.host/some_dir</span>
<span style="color: #666666; font-style: italic;">#   webdavs://user[:password]@other.host/some_dir </span>
<span style="color: #666666; font-style: italic;">###</span>
<span style="color: #666666; font-style: italic;"># TARGET='scheme://user[:password]@host[:port]/[/]path'</span>
<span style="color: #007800;">TARGET</span>=<span style="color: #ff0000;">'ftp://&lt;USER&gt;:&lt;PASS&gt;@&lt;HOST&gt;/&lt;DIR&gt;'</span>
<span style="color: #666666; font-style: italic;"># optionally the password can be defined as extra variable</span>
<span style="color: #666666; font-style: italic;"># if password is set already in TARGET, this setting replaces it</span>
<span style="color: #666666; font-style: italic;">#TARGET_PW='_backend_password_'</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># base directory to backup</span>
<span style="color: #007800;">SOURCE</span>=<span style="color: #ff0000;">'/'</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Time frame for old backups to keep, Used for the &quot;purge&quot; command.  </span>
<span style="color: #666666; font-style: italic;"># see duplicity man page, chapter TIME_FORMATS)</span>
<span style="color: #666666; font-style: italic;"># defaults to 1M, if not set</span>
<span style="color: #666666; font-style: italic;">#MAX_AGE=1M</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Number of full backups to keep. Used for the &quot;purge-full&quot; command. </span>
<span style="color: #666666; font-style: italic;"># See duplicity man page, action &quot;remove-all-but-n-full&quot;.</span>
<span style="color: #666666; font-style: italic;"># defaults to 1, if not set </span>
<span style="color: #666666; font-style: italic;">#MAX_FULL_BACKUPS=1</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># verbosity of output (5 for gpg errors, 9 for bug fixing)</span>
<span style="color: #666666; font-style: italic;"># default is 4, if not set</span>
<span style="color: #666666; font-style: italic;">#VERBOSITY=5</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># temporary file space. at least the size of the biggest file in backup</span>
<span style="color: #666666; font-style: italic;"># for a successful restoration process. (default is '/tmp', if not set)</span>
<span style="color: #666666; font-style: italic;">#TEMP_DIR=/tmp</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># sets duplicity --time-separator option (since v0.4.4.RC2) to allow users </span>
<span style="color: #666666; font-style: italic;"># to change the time separator from ':' to another character that will work </span>
<span style="color: #666666; font-style: italic;"># on their system.  HINT: For Windows SMB shares, use --time-separator='_'.</span>
<span style="color: #666666; font-style: italic;"># NOTE: '-' is not valid as it conflicts with date separator.</span>
<span style="color: #666666; font-style: italic;"># ATTENTION: only use this with duplicity &lt; 0.5.10, since then default file </span>
<span style="color: #666666; font-style: italic;">#            naming is compatible and this option is pending depreciation </span>
<span style="color: #666666; font-style: italic;">#DUPL_PARAMS=&quot;$DUPL_PARAMS --time-separator _ &quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># activates duplicity --short-filenames option, when uploading to a file</span>
<span style="color: #666666; font-style: italic;"># system that can't have filenames longer than 30 characters (e.g. Mac OS 8)</span>
<span style="color: #666666; font-style: italic;"># or have problems with ':' as part of the filename (e.g. Microsoft Windows)</span>
<span style="color: #666666; font-style: italic;"># ATTENTION: only use this with duplicity &lt; 0.5.10, since then default file </span>
<span style="color: #666666; font-style: italic;">#            naming is compatible and this option is pending depreciation  </span>
<span style="color: #666666; font-style: italic;">#DUPL_PARAMS=&quot;$DUPL_PARAMS --short-filenames &quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># activates duplicity --full-if-older-than option (since duplicity v0.4.4.RC3) </span>
<span style="color: #666666; font-style: italic;"># forces a full backup if last full backup reaches a specified age, for the </span>
<span style="color: #666666; font-style: italic;"># format of MAX_FULLBKP_AGE see duplicity man page, chapter TIME_FORMATS</span>
<span style="color: #666666; font-style: italic;">#MAX_FULLBKP_AGE=1M</span>
<span style="color: #666666; font-style: italic;">#DUPL_PARAMS=&quot;$DUPL_PARAMS --full-if-older-than $MAX_FULLBKP_AGE &quot; </span>
&nbsp;
<span style="color: #666666; font-style: italic;"># sets duplicity --volsize option (available since v0.4.3.RC7)</span>
<span style="color: #666666; font-style: italic;"># set the size of backup chunks to VOLSIZE MB instead of the default 5MB.</span>
<span style="color: #666666; font-style: italic;"># VOLSIZE must be number of MB's to set the volume size to. </span>
<span style="color: #666666; font-style: italic;">#VOLSIZE=50</span>
<span style="color: #666666; font-style: italic;">#DUPL_PARAMS=&quot;$DUPL_PARAMS --volsize $VOLSIZE &quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># more duplicity command line options can be added in the following way</span>
<span style="color: #666666; font-style: italic;"># don't forget to leave a separating space char at the end</span>
<span style="color: #666666; font-style: italic;">#DUPL_PARAMS=&quot;$DUPL_PARAMS --put_your_options_here &quot;</span></pre></td></tr></table></div>

<p>Und nun noch die Datei &#8220;<em>/root/.ftplicity/system/exclude</em>&#8220;:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>dev
<span style="color: #000000; font-weight: bold;">/</span>proc
<span style="color: #000000; font-weight: bold;">/</span>sys
<span style="color: #000000; font-weight: bold;">/</span>tmp
<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>cache
<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>tmp
<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>run</pre></td></tr></table></div>

<p>Danach erstellen wir unter &#8220;<em>/usr/local/sbin/</em>&#8221; die Datei <strong>db_backup</strong> mit Rechten &#8220;700&#8243;:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Script to backup MySQL and postgreSQL databases</span>
<span style="color: #666666; font-style: italic;"># author: johker</span>
&nbsp;
<span style="color: #666666; font-style: italic;">############### CHANGE THESE VARIABLE IF NECESSARY ####################</span>
&nbsp;
<span style="color: #007800;">MYSQL_USER</span>=<span style="color: #ff0000;">&quot;MYSQL_USER&quot;</span>
<span style="color: #007800;">MYSQL_PW</span>=<span style="color: #ff0000;">&quot;MYSQL_PASSWORD&quot;</span>
<span style="color: #007800;">POSTGRES_USER</span>=<span style="color: #ff0000;">&quot;POSTGRES_USER&quot;</span>
<span style="color: #007800;">POSTGRES_PW</span>=<span style="color: #ff0000;">&quot;POSTGRES_PASSWORD&quot;</span>
<span style="color: #007800;">TMP</span>=<span style="color: #ff0000;">&quot;/tmp/&quot;</span>
<span style="color: #007800;">FINAL_LOC</span>=<span style="color: #ff0000;">&quot;/var/backups/&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">################ DON'T CHANGE ANYTHING BELOW THIS LINE ################</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Creating backup of MySQL databases&quot;</span>
mysqldump -u<span style="color: #007800;">$MYSQL_USER</span> -p<span style="color: #007800;">$MYSQL_PW</span> <span style="color: #660033;">--all-databases</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #007800;">$FINAL_LOC</span><span style="color: #ff0000;">&quot;mysql.sql&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">gzip</span> <span style="color: #660033;">-f</span> <span style="color: #007800;">$FINAL_LOC</span><span style="color: #ff0000;">&quot;mysql.sql&quot;</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Creating backup of postgreSQL databases&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">su</span> <span style="color: #660033;">-c</span> <span style="color: #ff0000;">&quot;cd <span style="color: #007800;">$TMP</span> &amp;&amp; pg_dumpall &gt; <span style="color: #007800;">$TMP</span>'postgres.out'&quot;</span> <span style="color: #007800;">$POSTGRES_USER</span>
<span style="color: #c20cb9; font-weight: bold;">gzip</span> <span style="color: #660033;">-f</span> <span style="color: #007800;">$TMP</span><span style="color: #ff0000;">'postgres.out'</span> 
<span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #660033;">-f</span> <span style="color: #007800;">$TMP</span><span style="color: #ff0000;">'postgres.out.gz'</span> <span style="color: #007800;">$FINAL_LOC</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">640</span> <span style="color: #007800;">$FINAL_LOC</span><span style="color: #ff0000;">&quot;mysql.sql.gz&quot;</span> <span style="color: #007800;">$FINAL_LOC</span><span style="color: #ff0000;">&quot;postgres.out.gz&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">chown</span> root: <span style="color: #007800;">$FINAL_LOC</span><span style="color: #ff0000;">&quot;mysql.sql.gz&quot;</span> <span style="color: #007800;">$FINAL_LOC</span><span style="color: #ff0000;">&quot;postgres.out.gz&quot;</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span></pre></td></tr></table></div>

<p>Und in die Datei &#8220;<em>/root/.ftplicity/system/pre</em>&#8221; fügen wir folgende Zeile ein:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>db_backup</pre></td></tr></table></div>

<h2>Testen</h2>
<p>Mit folgendem Befehl kann man die ftplicity-Konfiguration testen:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ftplicity system status</pre></div></div>

<p>Wenn alles o.k. ist, kann man mit folgedem Befehl ein initiales Backup anlegen:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ftplicity system backup</pre></div></div>

<h2>Erstellen eines Cronjobs</h2>
<p>Da wir das Backup nicht jedes mal händisch anstoßen wollen, hier einträge für die crontab von root (editierbar per &#8220;<em>crontab -e</em>&#8221; als Benutzer <em>root</em>):</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># run the (incremental) backup each night at 03:23h</span>
<span style="color: #000000;">23</span> <span style="color: #000000;">3</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ftplicity system backup
<span style="color: #666666; font-style: italic;"># do a full backup once per month &amp; delete old backups at 04:47h</span>
<span style="color: #000000;">47</span> <span style="color: #000000;">4</span> <span style="color: #000000;">1</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ftplicity system purge <span style="color: #660033;">--force</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ftplicity system purge-full <span style="color: #660033;">--force</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ftplicity system full</pre></td></tr></table></div>

<h1>Quellen</h1>
<p>http://www.howtoforge.com/ftp-backups-with-duplicity-ftplicity-debian-etch</p>
<p>http://maff.ailoo.net/2009/07/backup-virtual-machines-lvm-snapshots-ftplicity-duplicity/</p>
<p>http://robert.penz.name/161/howto-backup-your-dedicated-server-to-a-foreign-ftp-server/</p>
]]></content:encoded>
			<wfw:commentRss>http://johker.ibutho.de/2009/08/02/der-neue-server-teil-9-backup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

