backupgem 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +6 -0
- data/README +387 -0
- data/bin/backup +12 -0
- data/bin/commands.sh +2 -0
- data/doc/LICENSE-GPL +280 -0
- data/doc/index.html +716 -0
- data/doc/styles.css +157 -0
- data/examples/global.rb +28 -0
- data/examples/mediawiki.rb +24 -0
- data/lib/backup/actor.rb +196 -0
- data/lib/backup/cli.rb +105 -0
- data/lib/backup/configuration.rb +138 -0
- data/lib/backup/date_parser.rb +37 -0
- data/lib/backup/extensions.rb +17 -0
- data/lib/backup/recipes/standard.rb +89 -0
- data/lib/backup/rotator.rb +155 -0
- data/lib/backup/ssh_helpers.rb +138 -0
- data/lib/backup.rb +7 -0
- data/tests/actor_test.rb +70 -0
- data/tests/cleanup.sh +2 -0
- data/tests/rotation_test.rb +32 -0
- data/tests/ssh_test.rb +21 -0
- data/tests/tests_helper.rb +5 -0
- metadata +99 -0
data/doc/index.html
ADDED
@@ -0,0 +1,716 @@
|
|
1
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>BackupGem Manual</title>
|
5
|
+
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
|
6
|
+
<meta name="generator" content="Click">
|
7
|
+
<style type="text/css">
|
8
|
+
@import url("styles.css");
|
9
|
+
</style>
|
10
|
+
</head>
|
11
|
+
<body>
|
12
|
+
<div id="container">
|
13
|
+
<div id="header"><h1>BackupGem Manual</h1></div>
|
14
|
+
|
15
|
+
<div id="wrapper">
|
16
|
+
<div id="content">
|
17
|
+
|
18
|
+
<div class="rightad">
|
19
|
+
<script type="text/javascript"><!--
|
20
|
+
google_ad_client = "pub-0934913060779093";
|
21
|
+
google_ad_width = 120;
|
22
|
+
google_ad_height = 600;
|
23
|
+
google_ad_format = "120x600_as";
|
24
|
+
google_ad_type = "image";
|
25
|
+
//2006-10-06: backup_skyscraper1
|
26
|
+
google_ad_channel ="7310496335";
|
27
|
+
//--></script>
|
28
|
+
<script type="text/javascript"
|
29
|
+
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
|
30
|
+
</script>
|
31
|
+
</div>
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
<a name="Introduction"></a><h2>Introduction</h2>
|
38
|
+
|
39
|
+
<a name="Introduction_Welcome"
|
40
|
+
></a><h3>Welcome</h3>
|
41
|
+
<p><code><span class="constant">Backup</span></code> is the easiest and most flexible backup, archive and rotate tool. It’s a beginning-to-end solution for scheduled backups in a clean ruby package that is simple use and powerful when customized.
|
42
|
+
Backup allows you to specify each of the following options:</p>
|
43
|
+
|
44
|
+
|
45
|
+
<ul>
|
46
|
+
<li>what is being archived (files, folders, arbitrary scripts)</li>
|
47
|
+
<li>how it’s being archived (tar gzip, bz2)</li>
|
48
|
+
<li>where the archive is going (multiple backup servers? easy)</li>
|
49
|
+
<li>how the archive is going to get there (scp, ftp, mv)</li>
|
50
|
+
<li>where is will be stored when it gets there</li>
|
51
|
+
<li>how it’s going to be rotated when it gets there (grandfather-father-son, etc)</li>
|
52
|
+
<li>how often will this process happen (customizable cycles)</li>
|
53
|
+
<li>what happens to the working copy after the process (recreate files, folders etc. restart daemons)</li>
|
54
|
+
</ul>
|
55
|
+
|
56
|
+
|
57
|
+
<p>Backup is a collection of scripts that is complete enough to save you time, but flexible enough to work with any situation.
|
58
|
+
This is an early version of <code><span class="constant">Backup</span></code>. Please feel free to ask questions on how to use <code><span class="constant">Backup</span></code> or post suggestions for this manual in the <a href="http://rubyforge.org/mailman/listinfo/backupgem-users">mailing lists</a></p>
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
<a name="Housekeeping"></a><h2>Housekeeping</h2>
|
64
|
+
|
65
|
+
<a name="Housekeeping_Prerequisites"
|
66
|
+
></a><h3>Prerequisites</h3>
|
67
|
+
<p><code><span class="constant">Backup</span></code> makes the following assumptions about your machines:</p>
|
68
|
+
|
69
|
+
|
70
|
+
<ul>
|
71
|
+
<li>server and client understand <span class="caps">POSIX</span> commmands</li>
|
72
|
+
<li>passwords and paths are the same on each backup server</li>
|
73
|
+
</ul>
|
74
|
+
|
75
|
+
|
76
|
+
<p><code><span class="constant">Backup</span></code> depends on the following libraries:</p>
|
77
|
+
|
78
|
+
|
79
|
+
<ul>
|
80
|
+
<li><a href="http://runt.rubyforge.org/">Runt</a> for describing temporal ranges.</li>
|
81
|
+
<li><a href="http://net-ssh.rubyforge.org/">Net::SSH</a> for <span class="caps">SSH</span> backups</li>
|
82
|
+
<li><a href="http://www.ruby-doc.org/stdlib/libdoc/net/ftp/rdoc/index.html">Net::FTP</a> for <span class="caps">FTP</span> backups</li>
|
83
|
+
</ul>
|
84
|
+
|
85
|
+
|
86
|
+
<p>These are listed as dependencies in the gem file so you should be prompted to install them when you install Backup.</p>
|
87
|
+
|
88
|
+
<a name="Housekeeping_Using_RubyGems"
|
89
|
+
></a><h3>Using RubyGems</h3>
|
90
|
+
If you have <a href="http://rubygems.rubyforge.org">RubyGems</a> installed, installing Backup is simple:
|
91
|
+
<blockquote>
|
92
|
+
<p><code><span class="ident">sudo</span> <span class="ident">gem</span> <span class="ident">install</span> <span class="ident">backupgem</span></code></p>
|
93
|
+
</blockquote>
|
94
|
+
|
95
|
+
<a name="Housekeeping_Using_svn"
|
96
|
+
></a><h3>Using svn</h3>
|
97
|
+
If you prefer, you can checkout backupgem from the <a href="http://rubyforge.org/scm/?group_id=2110">RubyForge Repository</a>. Feel free to browse the releases or trunk <a href="http://rubyforge.org/scm/?group_id=2110">here</a>.
|
98
|
+
<blockquote>
|
99
|
+
<p><code><span class="ident">svn</span> <span class="ident">checkout</span> <span class="ident">svn</span><span class="punct">+</span><span class="ident">ssh</span><span class="punct">:/</span><span class="regex"></span><span class="punct">/</span><span class="ident">rubyforge</span><span class="punct">.</span><span class="ident">org</span><span class="punct">/</span><span class="ident">var</span><span class="punct">/</span><span class="ident">svn</span><span class="punct">/</span><span class="ident">backupgem</span></code></p>
|
100
|
+
</blockquote>
|
101
|
+
|
102
|
+
<a name="Housekeeping_License_Information"
|
103
|
+
></a><h3>License Information</h3>
|
104
|
+
<p>Backup is made available under either the <span class="caps">BSD</span> license, or the same license Ruby (which, by extension, also allows the <span class="caps">GPL</span> as a permissable license as well). You can view the full text of any of these licenses in the <code><span class="ident">doc</span></code> subdirectory of the Backup distrubtion. The texts of the <span class="caps">BSD</span> and <span class="caps">GPL</span> licenses are also available online: <a href="http://www.opensource.org/licenses/bsd-license.php"><span class="caps">BSD</span></a> and <a href="http://www.opensource.org/licenses/gpl-license.php"><span class="caps">GPL</span></a>.</p>
|
105
|
+
|
106
|
+
|
107
|
+
<p>If you desire permission to use either Backup in a manner incompatible with these licenses, please contact the copyright holder <a href="mailto:nate+backup@natemurray.com">Nate Murray</a> in order to negotiate a more compatible license.</p>
|
108
|
+
|
109
|
+
<a name="Housekeeping_Support"
|
110
|
+
></a><h3>Support</h3>
|
111
|
+
<p>Mailing lists, bug trackers, feature requests, and public forums are all available courtesty of <a href="http://rubyforge.org">RubyForge</a> at the <a href="http://rubyforge.org/projects/backupgem">BackupGem project page</a>.</p>
|
112
|
+
|
113
|
+
<a name="Housekeeping_Mailing_Lists"
|
114
|
+
></a><h3>Mailing Lists</h3>
|
115
|
+
<table>
|
116
|
+
<tr>
|
117
|
+
<th>List Name </th>
|
118
|
+
<th> </th>
|
119
|
+
<th>Desc. </th>
|
120
|
+
</tr>
|
121
|
+
<tr>
|
122
|
+
<td> <a href="http://rubyforge.org/pipermail/backupgem-users">backupgem-users</a> </td>
|
123
|
+
<td> <a href="http://rubyforge.org/mailman/listinfo/backupgem-users">subscribe / unsubscribe</a> </td>
|
124
|
+
<td> The BackupGem users list is devoted to the discussion of and questions about the usage of Backup. If you can’t quite figure out how to get a feature of Backup to work, this is the list you would go to in order to ask your questions. </td>
|
125
|
+
</tr>
|
126
|
+
<tr>
|
127
|
+
<td> <a href="http://rubyforge.org/pipermail/backupgem-devel">backupgem-devel</a> </td>
|
128
|
+
<td> <a href="http://rubyforge.org/mailman/listinfo/backupgem-devel">subscribe / unsubscribe</a> </td>
|
129
|
+
<td> The Backup developers list is devoted to the discussion of Backup’s implementation. If you have created a patch that you would like to discuss, or if you would like to discuss a new feature, this is the list for you. </td>
|
130
|
+
</tr>
|
131
|
+
</table>
|
132
|
+
|
133
|
+
<a name="Housekeeping_About_the_Author"
|
134
|
+
></a><h3>About the Author</h3>
|
135
|
+
<p>Backup was written by <a href="mailto:nate@natemurray.com">Nate Murray</a>.</p>
|
136
|
+
|
137
|
+
|
138
|
+
<p>Nate currently works at an internet retailer in Southern California. Feel free to send him compliments, money, praise, or new feature patches. You can also send questions and suggestions. However, for bug reports and general feature requests, please use the trackers on the <a href="http://rubyforge.org/projects/backupgem">BackupGem project page</a>.</p>
|
139
|
+
|
140
|
+
<a name="Housekeeping_Special_Thanks"
|
141
|
+
></a><h3>Special Thanks</h3>
|
142
|
+
<p>Special thanks to:</p>
|
143
|
+
|
144
|
+
|
145
|
+
<ul>
|
146
|
+
<li>Matt Pulver for help with various technical problems and ideas.</li>
|
147
|
+
<li>Jamis Buck for writing <a href="http://weblog.rubyonrails.com/2006/8/30/capistrano-1-1-9-beta">Capistrano</a>. Capistrano provided the inspiration and some code for this work. Additionally, the Net::SSH manual provided partial inspiration for this manual. </li>
|
148
|
+
<li><a href="mailto:info@digitalclash.com">Matthew Lipper</a> for writing the Runt Ruby Temporal Expressions Library</li>
|
149
|
+
<li><a href="http://whytheluckystiff.net/">why the lucky stiff</a> for inspiration and some of the code to generate this manual.</li>
|
150
|
+
</ul>
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
<div class="ad">
|
155
|
+
|
156
|
+
<script type="text/javascript"><!--
|
157
|
+
google_ad_client = "pub-0934913060779093";
|
158
|
+
google_ad_width = 728;
|
159
|
+
google_ad_height = 90;
|
160
|
+
google_ad_format = "728x90_as";
|
161
|
+
google_ad_type = "text_image";
|
162
|
+
//2006-10-06: backup_before_recipe_1
|
163
|
+
google_ad_channel ="7683863986";
|
164
|
+
//--></script>
|
165
|
+
<script type="text/javascript"
|
166
|
+
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
|
167
|
+
</script>
|
168
|
+
|
169
|
+
</div>
|
170
|
+
|
171
|
+
<a name="How_Backup_Works"></a><h2>How Backup Works</h2>
|
172
|
+
|
173
|
+
<a name="How_Backup_Works_A_Typical_Backup"
|
174
|
+
></a><h3>A Typical Backup</h3>
|
175
|
+
<p>A typical backup has the following sequence:</p>
|
176
|
+
|
177
|
+
|
178
|
+
<ul>
|
179
|
+
<li>content</li>
|
180
|
+
<li>compress</li>
|
181
|
+
<li>encrypt</li>
|
182
|
+
<li>deliver</li>
|
183
|
+
<li>rotate</li>
|
184
|
+
<li>cleanup</li>
|
185
|
+
</ul>
|
186
|
+
|
187
|
+
|
188
|
+
<p>This order is the default, however, like most things it is customizable. Think of it like a pipline: the input of each step is the output of the last step.
|
189
|
+
Each of these things are specified in a <code><span class="ident">recipe</span></code> file which is describe below.</p>
|
190
|
+
|
191
|
+
<a name="How_Backup_Works_CLI"
|
192
|
+
></a><h3>CLI</h3>
|
193
|
+
<div class='example'><pre><code> <span class="constant">Usage</span><span class="punct">:</span> <span class="punct">./</span><span class="regex">backup [options]
|
194
|
+
Recipe Options -----------------------
|
195
|
+
-r, --recipe RECIPE A recipe file to load.
|
196
|
+
|
197
|
+
-g, --global FILE Specify the global recipe file to work
|
198
|
+
with. Defaults to the file +global.rb+
|
199
|
+
in the directory of +recipe+
|
200
|
+
-s, --set NAME=VALUE Specify a variable and it's value to
|
201
|
+
set. This will be set after loading all
|
202
|
+
recipe files.</span></code></pre></div>
|
203
|
+
|
204
|
+
<p><code><span class="constant">Backup</span></code> <i>is still in an early version. For now, I run the script directly from its <code><span class="ident">bin</span></code> folder in <code><span class="global">$GEMSROOT</span></code>. This will be moved to something like <code><span class="punct">/</span><span class="regex">usr</span><span class="punct">/</span><span class="ident">local</span><span class="punct">/</span><span class="ident">lib</span></code> in a future version. Patches to do this are welcome.</i></p>
|
205
|
+
|
206
|
+
|
207
|
+
<p>For now, you can run backup like so:</p>
|
208
|
+
|
209
|
+
|
210
|
+
<div class='example'><pre><code> <span class="punct">/</span><span class="regex">usr</span><span class="punct">/</span><span class="ident">local</span><span class="punct">/</span><span class="ident">lib</span><span class="punct">/</span><span class="ident">ruby</span><span class="punct">/</span><span class="ident">gems</span><span class="punct">/</span><span class="number">1.8</span><span class="punct">/</span><span class="ident">gems</span><span class="punct">/</span><span class="ident">backupgem</span><span class="punct">-</span><span class="number">0.0</span><span class="punct">.</span><span class="number">2</span><span class="punct">/</span><span class="ident">bin</span><span class="punct">/</span><span class="ident">backup</span> <span class="punct">--</span><span class="ident">recipe</span> <span class="punct">/</span><span class="ident">path</span><span class="punct">/</span><span class="ident">to</span><span class="punct">/</span><span class="ident">examples</span><span class="punct">/</span><span class="ident">mediawiki</span><span class="punct">.</span><span class="ident">rb</span></code></pre></div>
|
211
|
+
|
212
|
+
<p>Usually, you would set this as a cron job or something similar.</p>
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
<a name="Backup_Recipe_File_Format"></a><h2>Backup Recipe File Format</h2>
|
218
|
+
|
219
|
+
<a name="Backup_Recipe_File_Format_Recipes_Explained"
|
220
|
+
></a><h3>Recipes Explained</h3>
|
221
|
+
<div class="longlist">
|
222
|
+
|
223
|
+
<ul>
|
224
|
+
<li>The Backup Recipe format is pure ruby code. Anything that is valid ruby is valid in the recipe file. There are, however, a number of shortcuts that will make your life easier.</li>
|
225
|
+
<li>Each of the steps are specified as an <code><span class="ident">action</span></code>. (An action is really nothing more than a method that becomes defined in the Actor instance. See the <a href="http://rubyforge.org/docman/?group_id=2110"><span class="caps">API</span> docs</a> if you’re interestd.)</li>
|
226
|
+
<li>You may create “hook” actions for any of the actions. So if you define a method <code><span class="ident">before_content</span></code> it will be called immediately before <code><span class="comment">#content</span></code> is called. A method named <code><span class="ident">after_rotation</span></code> would be called after <code><span class="comment">#rotation</span></code>. This may not always be needed as you can customize the rotation order by setting the <code><span class="ident">action_order</span></code>. See the <code><span class="ident">recipes</span><span class="punct">/</span><span class="ident">standard</span><span class="punct">.</span><span class="ident">rb</span></code> file for examples.</li>
|
227
|
+
<li>In each action, the variable <code><span class="ident">last_result</span></code> is set. This is the return value of the previously called method in the chain. Note that this includes the output of the “hook” methods. </li>
|
228
|
+
<li>All configuration variables are available to actions via the hash <code><span class="ident">c</span><span class="punct">[]</span></code>. For example, the backup path is available to your actions as <code><span class="ident">c</span><span class="punct">[</span><span class="symbol">:backup_path</span><span class="punct">]</span></code>.</li>
|
229
|
+
</ul>
|
230
|
+
|
231
|
+
|
232
|
+
</div>
|
233
|
+
|
234
|
+
<a name="Backup_Recipe_File_Format_Variables"
|
235
|
+
></a><h3>Variables</h3>
|
236
|
+
<p>Setting variables is the bulk of the work you have to do when configuring your <code><span class="constant">Backup</span></code> scripts. These first two variables are required for all configurations.</p>
|
237
|
+
|
238
|
+
|
239
|
+
<p><i>The second variable could be omitted completely if the code was updated to use <code><span class="ident">tmpdir</span></code>. This is currently a <span class="caps">TODO</span>.</i></p>
|
240
|
+
|
241
|
+
|
242
|
+
<table>
|
243
|
+
<tr>
|
244
|
+
<th>Name </th>
|
245
|
+
<th>Desc. </th>
|
246
|
+
<th>Example </th>
|
247
|
+
</tr>
|
248
|
+
<tr>
|
249
|
+
<td> :backup_path </td>
|
250
|
+
<td> The path to place backup archives. </td>
|
251
|
+
<td> <code><span class="ident">set</span> <span class="symbol">:backup_path</span><span class="punct">,</span> <span class="punct">"</span><span class="string">/var/local/backups/mediawiki</span><span class="punct">"</span></code> </td>
|
252
|
+
</tr>
|
253
|
+
<tr>
|
254
|
+
<td> :tmp_dir </td>
|
255
|
+
<td> Specify a directory that backup can use as a temporary directory. Default <code><span class="punct">/</span><span class="regex">tmp</span></code>. </td>
|
256
|
+
<td> <code><span class="ident">set</span> <span class="symbol">:tmp_dir</span><span class="punct">,</span> <span class="constant">File</span><span class="punct">.</span><span class="ident">dirname</span><span class="punct">(</span><span class="constant">__FILE__</span><span class="punct">)</span> <span class="punct">+</span> <span class="punct">"</span><span class="string">/../tmp</span><span class="punct">"</span></code> </td>
|
257
|
+
</tr>
|
258
|
+
</table>
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
<p>The user running the script must have write permissions for each of these directories.</p>
|
264
|
+
|
265
|
+
<a name="Backup_Recipe_File_Format_Content"
|
266
|
+
></a><h3>Content</h3>
|
267
|
+
<p>The first step in any backup is to locate (or create) the content that is to be backed up. Backup provides a couple of shortcuts for common ways to locate content and allows you to arbitrarily define your own.
|
268
|
+
Some typical types of content are:</p>
|
269
|
+
|
270
|
+
|
271
|
+
<ul>
|
272
|
+
<li>a particular file</li>
|
273
|
+
<li>a particular folder</li>
|
274
|
+
<li>the contents of a particular folder</li>
|
275
|
+
</ul>
|
276
|
+
|
277
|
+
|
278
|
+
These could be specified like so:
|
279
|
+
<div class='example'><pre><code> <span class="ident">action</span> <span class="symbol">:content</span><span class="punct">,</span> <span class="symbol">:is_file</span> <span class="punct">=></span> <span class="punct">"</span><span class="string">/path/to/file</span><span class="punct">"</span> <span class="comment"># content is a single file</span>
|
280
|
+
<span class="ident">action</span> <span class="symbol">:content</span><span class="punct">,</span> <span class="symbol">:is_folder</span> <span class="punct">=></span> <span class="punct">"</span><span class="string">/path/to/folder</span><span class="punct">"</span> <span class="comment"># content is the folder itself </span>
|
281
|
+
<span class="ident">action</span> <span class="symbol">:content</span><span class="punct">,</span> <span class="symbol">:is_contents_of</span> <span class="punct">=></span> <span class="punct">"</span><span class="string">/path/to/other/folder</span><span class="punct">"</span> <span class="comment"># content is folder/* , recursive option</span></code></pre></div>
|
282
|
+
If you want <code><span class="symbol">:content</span></code> to be a series of shell commands just pass <code><span class="comment">#action</span></code> a block:
|
283
|
+
<div class='example'><pre><code> <span class="ident">action</span><span class="punct">(</span><span class="symbol">:content</span><span class="punct">)</span> <span class="keyword">do</span>
|
284
|
+
<span class="ident">sh</span> <span class="punct">"</span><span class="string">echo <span class="escape">\"</span>hello $HOSTNAME<span class="escape">\"</span></span><span class="punct">"</span>
|
285
|
+
<span class="ident">sh</span> <span class="punct">"</span><span class="string">mysqldump -uroot database > /path/to/db.sql</span><span class="punct">"</span>
|
286
|
+
<span class="punct">"</span><span class="string">/path/to/db.sql</span><span class="punct">"</span> <span class="comment"># make sure you return the full path to the folder/file you wish to be the content </span>
|
287
|
+
<span class="keyword">end</span></code></pre></div>
|
288
|
+
|
289
|
+
<a name="Backup_Recipe_File_Format_Compress"
|
290
|
+
></a><h3>Compress</h3>
|
291
|
+
Next you may want to compress your content. Again, there are a few one-liners for common cases and you can create your own.
|
292
|
+
<div class='example'><pre><code> <span class="ident">action</span> <span class="symbol">:compress</span><span class="punct">,</span> <span class="symbol">:method</span> <span class="punct">=></span> <span class="symbol">:tar_bz2</span> <span class="comment"># actually calls a method named tar_bz2 with output of ":content" ( or ":after_content" ) </span>
|
293
|
+
<span class="comment"># or</span>
|
294
|
+
<span class="ident">action</span> <span class="symbol">:compress</span><span class="punct">,</span> <span class="symbol">:method</span> <span class="punct">=></span> <span class="symbol">:tar_gzip</span></code></pre></div>
|
295
|
+
Again, you can create your own.
|
296
|
+
<div class='example'><pre><code> <span class="ident">action</span><span class="punct">(</span><span class="symbol">:compress</span><span class="punct">)</span>
|
297
|
+
<span class="ident">sh</span> <span class="punct">"</span><span class="string">my_tar <span class="expr">#{last_result}</span> <span class="expr">#{last_result}</span>.tar</span><span class="punct">"</span>
|
298
|
+
<span class="ident">sh</span> <span class="punct">"</span><span class="string">my_bzip <span class="expr">#{last_result}</span>.tar <span class="expr">#{last_result}</span>.tar.bz2</span><span class="punct">"</span>
|
299
|
+
<span class="ident">last_result</span> <span class="punct">+</span> <span class="punct">"</span><span class="string">.tar.bz2</span><span class="punct">"</span>
|
300
|
+
<span class="keyword">end</span></code></pre></div>
|
301
|
+
|
302
|
+
<a name="Backup_Recipe_File_Format_Encrypt"
|
303
|
+
></a><h3>Encrypt</h3>
|
304
|
+
Encryption is available to you, if you wish to use it.
|
305
|
+
<div class='example'><pre><code> <span class="ident">set</span> <span class="symbol">:encrypt</span><span class="punct">,</span> <span class="constant">true</span> <span class="comment"># default is +false+</span>
|
306
|
+
<span class="ident">set</span> <span class="symbol">:gpg_encrypt_options</span><span class="punct">,</span> <span class="punct">"</span><span class="string">--default-recipient</span><span class="punct">"</span> <span class="comment"># default is an empty string</span>
|
307
|
+
<span class="ident">action</span> <span class="symbol">:encrypt</span><span class="punct">,</span> <span class="symbol">:method</span> <span class="punct">=></span> <span class="symbol">:gpg</span> <span class="comment"># default, none</span></code></pre></div>
|
308
|
+
or your own:
|
309
|
+
<div class='example'><pre><code> <span class="ident">action</span><span class="punct">(</span><span class="symbol">:encrypt</span><span class="punct">)</span>
|
310
|
+
<span class="ident">sh</span> <span class="punct">"</span><span class="string">gpg <span class="expr">#{c[:gpg_encrypt_options]}</span> --encrypt <span class="expr">#{last_result}</span></span><span class="punct">"</span>
|
311
|
+
<span class="ident">last_result</span> <span class="punct">+</span> <span class="punct">"</span><span class="string">.gpg</span><span class="punct">"</span>
|
312
|
+
<span class="keyword">end</span></code></pre></div>
|
313
|
+
|
314
|
+
<p>I would recommend that you think seriously about how you wish to manage your keys for this backup process. If you are backing up encrypted data then you need to backup your keys or else risk losing access to your data. Secure key management is beyond the scope of this document.</p>
|
315
|
+
|
316
|
+
<a name="Backup_Recipe_File_Format_Delivery"
|
317
|
+
></a><h3>Delivery</h3>
|
318
|
+
<h4>Action</h4>
|
319
|
+
|
320
|
+
|
321
|
+
<p>Delivery is supported via <code><span class="ident">scp</span></code>, <code><span class="ident">ftp</span></code>, and <code><span class="ident">mv</span></code></p>
|
322
|
+
|
323
|
+
|
324
|
+
<p><i>Full <span class="caps">FTP</span> support is <a href="#Known_Bugs_and_Limitations_TODO">unfinished</a>. Currently, only <code><span class="ident">scp</span></code> and <code><span class="ident">mv</span></code> fully support rotation</i></p>
|
325
|
+
|
326
|
+
|
327
|
+
<div class='example'><pre><code> <span class="ident">action</span> <span class="symbol">:delivery</span><span class="punct">,</span> <span class="symbol">:method</span> <span class="punct">=></span> <span class="symbol">:scp</span>
|
328
|
+
<span class="ident">action</span> <span class="symbol">:delivery</span><span class="punct">,</span> <span class="symbol">:method</span> <span class="punct">=></span> <span class="symbol">:ftp</span>
|
329
|
+
<span class="ident">action</span> <span class="symbol">:delivery</span><span class="punct">,</span> <span class="symbol">:method</span> <span class="punct">=></span> <span class="symbol">:mv</span></code></pre></div>
|
330
|
+
The <code><span class="symbol">:mv</span></code> action is defined (in <code><span class="ident">backup</span><span class="punct">/</span><span class="ident">recipes</span><span class="punct">/</span><span class="ident">standard</span><span class="punct">.</span><span class="ident">rb</span></code>) like any user-defined action:
|
331
|
+
<div class='example'><pre><code> <span class="ident">action</span><span class="punct">(</span><span class="symbol">:mv</span><span class="punct">)</span> <span class="keyword">do</span>
|
332
|
+
<span class="ident">sh</span> <span class="punct">"</span><span class="string">mv <span class="expr">#{last_result}</span> <span class="expr">#{c[:backup_path]}</span>/</span><span class="punct">"</span>
|
333
|
+
<span class="ident">c</span><span class="punct">[</span><span class="symbol">:backup_path</span><span class="punct">]</span> <span class="attribute">@</span> <span class="punct">"</span><span class="string">/</span><span class="punct">"</span> <span class="attribute">@</span> <span class="constant">File</span><span class="punct">.</span><span class="ident">basename</span><span class="punct">(</span><span class="ident">last_result</span><span class="punct">)</span>
|
334
|
+
<span class="keyword">end</span></code></pre></div>
|
335
|
+
|
336
|
+
<h4>Variables</h4>
|
337
|
+
|
338
|
+
|
339
|
+
<table>
|
340
|
+
<tr>
|
341
|
+
<th>Name </th>
|
342
|
+
<th>Desc. </th>
|
343
|
+
<th>Example </th>
|
344
|
+
</tr>
|
345
|
+
<tr>
|
346
|
+
<td> <code><span class="symbol">:servers</span></code> </td>
|
347
|
+
<td> An array of host names to deliver the data to. <br /><strong><a href="#Known_Bugs_and_Limitations_TODO"><span class="caps">TODO</span></a> this currently supports one 1 server</strong>. </td>
|
348
|
+
<td> <code><span class="ident">set</span> <span class="symbol">:servers</span><span class="punct">,</span> <span class="punct">%w{</span><span class="string"> localhost </span><span class="punct">}</span></code> </td>
|
349
|
+
</tr>
|
350
|
+
<tr>
|
351
|
+
<td> <code><span class="symbol">:ssh_user</span></code> </td>
|
352
|
+
<td> The name of the ssh user on the foreign server. Default <span class="caps">ENV</span>[‘USER’]. </td>
|
353
|
+
<td> <code><span class="ident">set</span> <span class="symbol">:ssh_user</span><span class="punct">,</span> <span class="constant">ENV</span><span class="punct">['</span><span class="string">USER</span><span class="punct">']</span></code> </td>
|
354
|
+
</tr>
|
355
|
+
<tr>
|
356
|
+
<td> <code><span class="symbol">:identity_key</span></code> </td>
|
357
|
+
<td> The path to the key to use when ssh’ing into a foreign server. </td>
|
358
|
+
<td> <code><span class="ident">set</span> <span class="symbol">:identity_key</span><span class="punct">,</span> <span class="constant">ENV</span><span class="punct">['</span><span class="string">HOME</span><span class="punct">']</span> <span class="punct">+</span> <span class="punct">"</span><span class="string">/.ssh/id_rsa</span><span class="punct">"</span></code> </td>
|
359
|
+
</tr>
|
360
|
+
</table>
|
361
|
+
|
362
|
+
<a name="Backup_Recipe_File_Format_Rotate"
|
363
|
+
></a><h3>Rotate</h3>
|
364
|
+
<p>Rotation of your backups is a way to keep snapshot copies of your backups in time while not keeping every single backup for every single day. Currently the only form of rotation Backup supports is <a href="http://en.wikipedia.org/wiki/Grandfather-father-son">grandfather-father-son</a>. See <a href="http://en.wikipedia.org/wiki/Grandfather-father-son">Wikipedia</a> if you are unfamiliar with how this works.</p>
|
365
|
+
|
366
|
+
|
367
|
+
<div class='example'><pre><code> <span class="ident">set</span> <span class="symbol">:rotation_method</span><span class="punct">,</span> <span class="symbol">:gfs</span> <span class="comment"># this is the default. you don't need to set it and there are no other supported options</span></code></pre></div>
|
368
|
+
|
369
|
+
<p>By deafult, a <code><span class="ident">son</span></code> is created daily, unless it is a day to create a <code><span class="ident">father</span></code> or <code><span class="ident">grandfather</span></code>. It is assumed that every time you run Backup you want to create a backup. Therefore, if you do not want to a <code><span class="ident">son</span></code> (etc), do not run the program. You can specify when a <code><span class="ident">son</span></code> is promoted to a <code><span class="ident">father</span></code> by the following variable:</p>
|
370
|
+
|
371
|
+
|
372
|
+
<div class='example'><pre><code> <span class="ident">set</span> <span class="symbol">:son_promoted_on</span><span class="punct">,</span> <span class="symbol">:fri</span></code></pre></div>
|
373
|
+
|
374
|
+
<p>You specify when fathers are promoted to grandfathers by something like the following</p>
|
375
|
+
|
376
|
+
|
377
|
+
<div class='example'><pre><code> <span class="ident">set</span> <span class="symbol">:father_promoted_on</span><span class="punct">,</span> <span class="symbol">:last_fri_of_the_month</span></code></pre></div>
|
378
|
+
|
379
|
+
<p>Valid arguments for specifying these promotions are as follows:</p>
|
380
|
+
|
381
|
+
|
382
|
+
<ul>
|
383
|
+
<li><code><span class="symbol">:mon</span></code>-<code><span class="symbol">:sun</span></code> – A symbol of the abbreviation of any day of the week</li>
|
384
|
+
<li><code><span class="symbol">:last_</span><span class="punct">[</span><span class="ident">mon</span><span class="punct">-</span><span class="ident">sun</span><span class="punct">]</span><span class="ident">_of_the_month</span></code> – A symbol, replacing <code><span class="punct">[</span><span class="ident">mon</span><span class="punct">-</span><span class="ident">sun</span><span class="punct">]</span></code> with the
|
385
|
+
abbreviation for the day of the weeks. <br />
|
386
|
+
Example: <code><span class="symbol">:last_thu_of_the_month</span></code>.</li>
|
387
|
+
<li>Any valid <code><span class="constant">Runt</span></code> object.</li>
|
388
|
+
</ul>
|
389
|
+
|
390
|
+
|
391
|
+
Representing these temporal ranges is done internally by using <code><span class="constant">Runt</span></code>. You are, therefore, allowed to pass in your own arbitrarily complex <code><span class="constant">Runt</span></code> object. For example, say that you wanted to promote to <code><span class="ident">father</span></code> on Monday, Wednesday and Friday. You could do the following:
|
392
|
+
<div class='example'><pre><code> <span class="ident">mon_wed_fri</span> <span class="punct">=</span> <span class="constant">Runt</span><span class="punct">::</span><span class="constant">DIWeek</span><span class="punct">.</span><span class="ident">new</span><span class="punct">(</span><span class="constant">Runt</span><span class="punct">::</span><span class="constant">Mon</span><span class="punct">)</span> <span class="punct">|</span>
|
393
|
+
<span class="constant">Runt</span><span class="punct">::</span><span class="constant">DIWeek</span><span class="punct">.</span><span class="ident">new</span><span class="punct">(</span><span class="constant">Runt</span><span class="punct">::</span><span class="constant">Wed</span><span class="punct">)</span> <span class="punct">|</span>
|
394
|
+
<span class="constant">Runt</span><span class="punct">::</span><span class="constant">DIWeek</span><span class="punct">.</span><span class="ident">new</span><span class="punct">(</span><span class="constant">Runt</span><span class="punct">::</span><span class="constant">Fri</span><span class="punct">)</span>
|
395
|
+
<span class="ident">set</span> <span class="symbol">:son_promoted_on</span><span class="punct">,</span> <span class="ident">mon_wed_fri</span></code></pre></div>
|
396
|
+
|
397
|
+
<p>See the <a href="http://runt.rubyforge.org/">Runt documentation</a> for more information on this.</p>
|
398
|
+
|
399
|
+
|
400
|
+
<p>You can set how many of each rank to keep:</p>
|
401
|
+
|
402
|
+
|
403
|
+
<div class='example'><pre><code> <span class="comment"># assuming daily backups...</span>
|
404
|
+
<span class="ident">set</span> <span class="symbol">:sons_to_keep</span><span class="punct">,</span> <span class="number">14</span> <span class="comment"># this would be two weeks</span>
|
405
|
+
<span class="ident">set</span> <span class="symbol">:fathers_to_keep</span><span class="punct">,</span> <span class="number">6</span>
|
406
|
+
<span class="ident">set</span> <span class="symbol">:grandfathers_to_keep</span><span class="punct">,</span> <span class="number">6</span></code></pre></div>
|
407
|
+
|
408
|
+
|
409
|
+
|
410
|
+
|
411
|
+
<a name="Examples"></a><h2>Examples</h2>
|
412
|
+
|
413
|
+
<a name="Examples_Good_things_come_in_threes"
|
414
|
+
></a><h3>Good things come in threes</h3>
|
415
|
+
<p>Here we will cover three examples. </p>
|
416
|
+
|
417
|
+
|
418
|
+
<ul>
|
419
|
+
<li>a super-simple backup to a local directory. This will show how easy
|
420
|
+
things can be.</li>
|
421
|
+
<li>a more complex implementation. This will show some of the variables
|
422
|
+
you can set and show how to use a foreign server.</li>
|
423
|
+
<li>an even more complex configuration. This will show how to define
|
424
|
+
your own methods and set more advanced variables.</li>
|
425
|
+
</ul>
|
426
|
+
|
427
|
+
<a name="Examples_Example_One___Backup_a_Folder_of_Logs"
|
428
|
+
></a><h3>Example One | Backup a Folder of Logs</h3>
|
429
|
+
<p>Our first example will be backing up a folder of logs. Say we have a folder <code><span class="punct">/</span><span class="regex">var</span><span class="punct">/</span><span class="ident">my_logs</span><span class="punct">/</span></code> and it is full of log files.</p>
|
430
|
+
|
431
|
+
|
432
|
+
<p>What we want to do is:</p>
|
433
|
+
|
434
|
+
|
435
|
+
<ul>
|
436
|
+
<li>move out all the old log files</li>
|
437
|
+
<li>compress them and store them in a local folder</li>
|
438
|
+
<li>store 2 weeks of daily backups (sons)</li>
|
439
|
+
<li>store a weekly backup (father) going back 6 weeks</li>
|
440
|
+
<li>and create a monthly backup on the last friday of every month (grandfather) for 6 months</li>
|
441
|
+
</ul>
|
442
|
+
|
443
|
+
|
444
|
+
Thankfully, this is incredibly simple:
|
445
|
+
<div class='example'><pre><code> <span class="ident">set</span> <span class="symbol">:backup_path</span><span class="punct">,</span> <span class="punct">"</span><span class="string">/var/local/backups/my_old_logs</span><span class="punct">"</span>
|
446
|
+
<span class="ident">set</span> <span class="symbol">:tmp_dir</span><span class="punct">,</span> <span class="punct">"</span><span class="string">/tmp</span><span class="punct">"</span> <span class="comment"># this is the default so you actually dont have to specify it</span>
|
447
|
+
<span class="ident">action</span> <span class="symbol">:content</span><span class="punct">,</span> <span class="symbol">:is_contents_of</span> <span class="punct">=></span> <span class="punct">"</span><span class="string">/var/my_logs</span><span class="punct">"</span></code></pre></div>
|
448
|
+
|
449
|
+
<p>And thats it!</p>
|
450
|
+
|
451
|
+
|
452
|
+
<p>Notice a couple of things here.</p>
|
453
|
+
|
454
|
+
|
455
|
+
<ol>
|
456
|
+
<li>Each time we <code><span class="ident">set</span></code> a variable that becomes available to the actions as <code><span class="ident">c</span><span class="punct">[</span><span class="symbol">:var</span><span class="punct">]</span></code></li>
|
457
|
+
<li>In this case, make sure that <code><span class="symbol">:backup_path</span></code> and <code><span class="symbol">:tmp_dir</span></code> are writable by the user that is running the backup script.</li>
|
458
|
+
</ol>
|
459
|
+
|
460
|
+
<a name="Examples_Example_Two___SQL_Backup"
|
461
|
+
></a><h3>Example Two | SQL Backup</h3>
|
462
|
+
<p>Our second example will be backing up a <a href="http://www.mediawiki.org">MediaWiki</a> installation. Say we have a MySQL database named <code><span class="ident">mediawiki</span></code>.</p>
|
463
|
+
|
464
|
+
|
465
|
+
<p>This time we want to:</p>
|
466
|
+
|
467
|
+
|
468
|
+
<ul>
|
469
|
+
<li>create a dump of the database every day</li>
|
470
|
+
<li>compress this backup and store it in a local folder</li>
|
471
|
+
<li>store 2 weeks of daily backups (son) [<em>same as last time</em>]</li>
|
472
|
+
<li>store “father” backups every Monday, Wednesday and Friday going back 6 weeks</li>
|
473
|
+
<li>and create a monthly backup on the last Friday of every month (grandfather) for 6 months</li>
|
474
|
+
</ul>
|
475
|
+
|
476
|
+
|
477
|
+
<div class='example'><pre><code> <span class="ident">set</span> <span class="symbol">:backup_path</span><span class="punct">,</span> <span class="punct">"</span><span class="string">/var/local/backups/mediawiki</span><span class="punct">"</span>
|
478
|
+
|
479
|
+
<span class="ident">action</span><span class="punct">(</span><span class="symbol">:content</span><span class="punct">)</span> <span class="keyword">do</span>
|
480
|
+
<span class="ident">dump</span> <span class="punct">=</span> <span class="ident">c</span><span class="punct">[</span><span class="symbol">:tmp_dir</span><span class="punct">]</span> <span class="punct">+</span> <span class="punct">"</span><span class="string">/mediawiki.sql</span><span class="punct">"</span>
|
481
|
+
<span class="ident">sh</span> <span class="punct">"</span><span class="string">mysqldump -uroot mediawiki > <span class="expr">#{dump}</span></span><span class="punct">"</span>
|
482
|
+
<span class="ident">dump</span> <span class="comment"># make sure you return the name of the file</span>
|
483
|
+
<span class="keyword">end</span>
|
484
|
+
|
485
|
+
<span class="ident">action</span> <span class="symbol">:delivery</span><span class="punct">,</span> <span class="symbol">:method</span> <span class="punct">=></span> <span class="symbol">:scp</span>
|
486
|
+
<span class="ident">action</span> <span class="symbol">:rotate</span><span class="punct">,</span> <span class="symbol">:method</span> <span class="punct">=></span> <span class="symbol">:via_ssh</span>
|
487
|
+
|
488
|
+
<span class="ident">set</span> <span class="symbol">:servers</span><span class="punct">,</span> <span class="punct">%w{</span><span class="string"> my.server.com </span><span class="punct">}</span>
|
489
|
+
|
490
|
+
<span class="ident">set</span> <span class="symbol">:son_promoted_on</span><span class="punct">,</span> <span class="symbol">:sun</span>
|
491
|
+
<span class="ident">set</span> <span class="symbol">:father_promoted_on</span><span class="punct">,</span> <span class="symbol">:last_sun_of_the_month</span>
|
492
|
+
|
493
|
+
<span class="ident">set</span> <span class="symbol">:sons_to_keep</span><span class="punct">,</span> <span class="number">21</span>
|
494
|
+
<span class="ident">set</span> <span class="symbol">:fathers_to_keep</span><span class="punct">,</span> <span class="number">12</span>
|
495
|
+
<span class="ident">set</span> <span class="symbol">:grandfathers_to_keep</span><span class="punct">,</span> <span class="number">12</span></code></pre></div>
|
496
|
+
|
497
|
+
<p>A couple things to note:</p>
|
498
|
+
|
499
|
+
|
500
|
+
<ol>
|
501
|
+
<li>In this example, it is assumed that the current user running the
|
502
|
+
script has <code><span class="ident">ssh</span></code> keys configured for password-less login to
|
503
|
+
<code><span class="ident">my</span><span class="punct">.</span><span class="ident">server</span><span class="punct">.</span><span class="ident">com</span></code>. If you want to change the user to login as set the
|
504
|
+
variable <code><span class="symbol">:ssh_user</span></code>. You can also specify a key with
|
505
|
+
<code><span class="symbol">:identity_key</span></code>.</li>
|
506
|
+
<li>Number 1 is the only thing</li>
|
507
|
+
</ol>
|
508
|
+
|
509
|
+
<a name="Examples_Example_Three___Something_more_complex"
|
510
|
+
></a><h3>Example Three | Something more complex</h3>
|
511
|
+
<p>By now it should be easy to see what is going on here:</p>
|
512
|
+
|
513
|
+
|
514
|
+
<div class='example'><pre><code> <span class="ident">action</span> <span class="symbol">:content</span><span class="punct">,</span> <span class="symbol">:is_file</span> <span class="punct">=></span> <span class="punct">"</span><span class="string">/path/to/file.abc</span><span class="punct">"</span>
|
515
|
+
<span class="ident">action</span> <span class="symbol">:compress</span><span class="punct">,</span> <span class="symbol">:method</span> <span class="punct">=></span> <span class="symbol">:my_tar_gzip</span>
|
516
|
+
|
517
|
+
<span class="ident">action</span><span class="punct">(</span><span class="symbol">:my_tar_gzip</span><span class="punct">)</span> <span class="keyword">do</span>
|
518
|
+
<span class="ident">name</span> <span class="punct">=</span> <span class="ident">c</span><span class="punct">[</span><span class="symbol">:tmp_dir</span><span class="punct">]</span> <span class="punct">+</span> <span class="punct">"</span><span class="string">/</span><span class="punct">"</span> <span class="punct">+</span> <span class="constant">File</span><span class="punct">.</span><span class="ident">basename</span><span class="punct">(</span><span class="ident">last_result</span><span class="punct">)</span> <span class="punct">+</span> <span class="punct">"</span><span class="string">.tar.gzip</span><span class="punct">"</span>
|
519
|
+
<span class="ident">sh</span> <span class="punct">"</span><span class="string">tar -czv --exclude .DS* --exclude CVS <span class="expr">#{last_result}</span> > <span class="expr">#{name}</span></span><span class="punct">"</span>
|
520
|
+
<span class="ident">name</span> <span class="comment"># make sure you return the name of the tar.gzip file</span>
|
521
|
+
<span class="keyword">end</span>
|
522
|
+
|
523
|
+
<span class="ident">set</span> <span class="symbol">:encrypt</span><span class="punct">,</span> <span class="constant">true</span>
|
524
|
+
|
525
|
+
<span class="ident">action</span> <span class="symbol">:deliver</span><span class="punct">,</span> <span class="symbol">:method</span> <span class="punct">=></span> <span class="symbol">:scp</span>
|
526
|
+
<span class="ident">action</span> <span class="symbol">:rotate</span><span class="punct">,</span> <span class="symbol">:method</span> <span class="punct">=></span> <span class="symbol">:via_ssh</span>
|
527
|
+
|
528
|
+
<span class="ident">set</span> <span class="symbol">:ssh_user</span><span class="punct">,</span> <span class="punct">"</span><span class="string">backup_user</span><span class="punct">"</span>
|
529
|
+
<span class="ident">set</span> <span class="symbol">:identity_key</span><span class="punct">,</span> <span class="constant">ENV</span><span class="punct">['</span><span class="string">HOME</span><span class="punct">']</span> <span class="punct">+</span> <span class="punct">"</span><span class="string">/.ssh/backup_key</span><span class="punct">"</span></code></pre></div>
|
530
|
+
|
531
|
+
|
532
|
+
|
533
|
+
<div class="ad">
|
534
|
+
|
535
|
+
<script type="text/javascript"><!--
|
536
|
+
google_ad_client = "pub-0934913060779093";
|
537
|
+
google_ad_width = 728;
|
538
|
+
google_ad_height = 90;
|
539
|
+
google_ad_format = "728x90_as";
|
540
|
+
google_ad_type = "text_image";
|
541
|
+
//2006-10-06: backup_before_recipe_1
|
542
|
+
google_ad_channel ="7683863986";
|
543
|
+
//--></script>
|
544
|
+
<script type="text/javascript"
|
545
|
+
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
|
546
|
+
</script>
|
547
|
+
|
548
|
+
</div>
|
549
|
+
|
550
|
+
<a name="Known_Bugs_and_Limitations"></a><h2>Known Bugs and Limitations</h2>
|
551
|
+
|
552
|
+
<a name="Known_Bugs_and_Limitations_TODO"
|
553
|
+
></a><h3>TODO</h3>
|
554
|
+
<p>What is left to do:</p>
|
555
|
+
|
556
|
+
|
557
|
+
<ul>
|
558
|
+
<li>Finish <span class="caps">FTP</span> support</li>
|
559
|
+
<li>Add support for multiple backup servers</li>
|
560
|
+
<li>Add in better logging </li>
|
561
|
+
<li>Remove all the <code><span class="ident">tmp_dir</span></code> references. use and test the standard library <code><span class="ident">tmpdir</span></code></li>
|
562
|
+
<li>Continue testing it</li>
|
563
|
+
</ul>
|
564
|
+
|
565
|
+
|
566
|
+
<p>If you find yourself writing the code for <code><span class="constant">Backup</span></code> to fix these things, please consider <a href="http://rubyforge.org/mailman/listinfo/backupgem-devel">submitting your patch</a> for the benefit of the community.</p>
|
567
|
+
|
568
|
+
<a name="Known_Bugs_and_Limitations_BUGS"
|
569
|
+
></a><h3>BUGS</h3>
|
570
|
+
<ul>
|
571
|
+
<li>You can’t <code><span class="keyword">return</span></code> in the user-defined actions for some reason. I think this
|
572
|
+
has to do with the <code><span class="ident">instance_eval</span></code>. But still, I wouldn’t think it would
|
573
|
+
matter. I’d be interested in any suggestions on how to fix this.</li>
|
574
|
+
<li>Please submit other bugs via the trackers at the
|
575
|
+
<a href="http://rubyforge.org/projects/backupgem">BackupGem project page</a>.</li>
|
576
|
+
</ul>
|
577
|
+
|
578
|
+
|
579
|
+
|
580
|
+
|
581
|
+
</div> <!-- end content -->
|
582
|
+
</div> <!-- end wrapper -->
|
583
|
+
|
584
|
+
<div id="navigation">
|
585
|
+
<ol>
|
586
|
+
|
587
|
+
<li><a href="#Introduction">Introduction</a>
|
588
|
+
<ol>
|
589
|
+
|
590
|
+
<li><a href="#Introduction_Welcome"
|
591
|
+
>Welcome</a></li>
|
592
|
+
|
593
|
+
</ol>
|
594
|
+
</li>
|
595
|
+
|
596
|
+
<li><a href="#Housekeeping">Housekeeping</a>
|
597
|
+
<ol>
|
598
|
+
|
599
|
+
<li><a href="#Housekeeping_Prerequisites"
|
600
|
+
>Prerequisites</a></li>
|
601
|
+
|
602
|
+
<li><a href="#Housekeeping_Using_RubyGems"
|
603
|
+
>Using RubyGems</a></li>
|
604
|
+
|
605
|
+
<li><a href="#Housekeeping_Using_svn"
|
606
|
+
>Using svn</a></li>
|
607
|
+
|
608
|
+
<li><a href="#Housekeeping_License_Information"
|
609
|
+
>License Information</a></li>
|
610
|
+
|
611
|
+
<li><a href="#Housekeeping_Support"
|
612
|
+
>Support</a></li>
|
613
|
+
|
614
|
+
<li><a href="#Housekeeping_Mailing_Lists"
|
615
|
+
>Mailing Lists</a></li>
|
616
|
+
|
617
|
+
<li><a href="#Housekeeping_About_the_Author"
|
618
|
+
>About the Author</a></li>
|
619
|
+
|
620
|
+
<li><a href="#Housekeeping_Special_Thanks"
|
621
|
+
>Special Thanks</a></li>
|
622
|
+
|
623
|
+
</ol>
|
624
|
+
</li>
|
625
|
+
|
626
|
+
<li><a href="#How_Backup_Works">How Backup Works</a>
|
627
|
+
<ol>
|
628
|
+
|
629
|
+
<li><a href="#How_Backup_Works_A_Typical_Backup"
|
630
|
+
>A Typical Backup</a></li>
|
631
|
+
|
632
|
+
<li><a href="#How_Backup_Works_CLI"
|
633
|
+
>CLI</a></li>
|
634
|
+
|
635
|
+
</ol>
|
636
|
+
</li>
|
637
|
+
|
638
|
+
<li><a href="#Backup_Recipe_File_Format">Backup Recipe File Format</a>
|
639
|
+
<ol>
|
640
|
+
|
641
|
+
<li><a href="#Backup_Recipe_File_Format_Recipes_Explained"
|
642
|
+
>Recipes Explained</a></li>
|
643
|
+
|
644
|
+
<li><a href="#Backup_Recipe_File_Format_Variables"
|
645
|
+
>Variables</a></li>
|
646
|
+
|
647
|
+
<li><a href="#Backup_Recipe_File_Format_Content"
|
648
|
+
>Content</a></li>
|
649
|
+
|
650
|
+
<li><a href="#Backup_Recipe_File_Format_Compress"
|
651
|
+
>Compress</a></li>
|
652
|
+
|
653
|
+
<li><a href="#Backup_Recipe_File_Format_Encrypt"
|
654
|
+
>Encrypt</a></li>
|
655
|
+
|
656
|
+
<li><a href="#Backup_Recipe_File_Format_Delivery"
|
657
|
+
>Delivery</a></li>
|
658
|
+
|
659
|
+
<li><a href="#Backup_Recipe_File_Format_Rotate"
|
660
|
+
>Rotate</a></li>
|
661
|
+
|
662
|
+
</ol>
|
663
|
+
</li>
|
664
|
+
|
665
|
+
<li><a href="#Examples">Examples</a>
|
666
|
+
<ol>
|
667
|
+
|
668
|
+
<li><a href="#Examples_Good_things_come_in_threes"
|
669
|
+
>Good things come in threes</a></li>
|
670
|
+
|
671
|
+
<li><a href="#Examples_Example_One___Backup_a_Folder_of_Logs"
|
672
|
+
>Example One | Backup a Folder of Logs</a></li>
|
673
|
+
|
674
|
+
<li><a href="#Examples_Example_Two___SQL_Backup"
|
675
|
+
>Example Two | SQL Backup</a></li>
|
676
|
+
|
677
|
+
<li><a href="#Examples_Example_Three___Something_more_complex"
|
678
|
+
>Example Three | Something more complex</a></li>
|
679
|
+
|
680
|
+
</ol>
|
681
|
+
</li>
|
682
|
+
|
683
|
+
<li><a href="#Known_Bugs_and_Limitations">Known Bugs and Limitations</a>
|
684
|
+
<ol>
|
685
|
+
|
686
|
+
<li><a href="#Known_Bugs_and_Limitations_TODO"
|
687
|
+
>TODO</a></li>
|
688
|
+
|
689
|
+
<li><a href="#Known_Bugs_and_Limitations_BUGS"
|
690
|
+
>BUGS</a></li>
|
691
|
+
|
692
|
+
</ol>
|
693
|
+
</li>
|
694
|
+
|
695
|
+
</ol>
|
696
|
+
|
697
|
+
</div>
|
698
|
+
|
699
|
+
<div id="extra">
|
700
|
+
<ul>
|
701
|
+
<li><a href="http://tech.natemurray.com">tech.natemurray.com</a></li>
|
702
|
+
</ul>
|
703
|
+
|
704
|
+
</div>
|
705
|
+
|
706
|
+
<div id="footer">
|
707
|
+
<p>
|
708
|
+
© 2006 <a href="mailto:nate+backupgem@natemurray.com">Nate Murray</a>. <span class="last_updated">Last updated Fri Oct 06 15:11:51 PDT 2006</span>
|
709
|
+
</p>
|
710
|
+
|
711
|
+
</div>
|
712
|
+
|
713
|
+
|
714
|
+
</div> <!-- end container -->
|
715
|
+
</body>
|
716
|
+
</html>
|