syc-backup 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +1 -1
- data/doc/Backup/CronEdit.html +18 -4
- data/doc/README_rdoc.html +25 -6
- data/doc/created.rid +7 -7
- data/doc/table_of_contents.html +1 -0
- data/lib/backup/options.rb +9 -0
- data/lib/backup/process.rb +31 -1
- data/lib/backup/runner.rb +4 -2
- data/lib/backup_version.rb +1 -1
- data/{syc-backup-0.0.5.gem → syc-backup-0.0.6.gem} +0 -0
- data/sycbackup.gemspec +1 -2
- data/test/test_process.rb +30 -0
- metadata +40 -5
data/README.rdoc
CHANGED
@@ -25,7 +25,7 @@ Create a cron job that is scheduled every day at 2:30
|
|
25
25
|
$ sycbackup -d database -uuser -ppass -f directory,file1 --cron 30,2,*,*,*
|
26
26
|
|
27
27
|
If the user or password contains characters as '(' you have to escape
|
28
|
-
them. A password like 123(56 has to be provided with pass\"123
|
28
|
+
them. A password like 123(56 has to be provided with pass\"123\(56\".
|
29
29
|
|
30
30
|
== Usage of --override and --no-compress
|
31
31
|
Whether the backup directory and the backup files are time stamped depends how
|
data/doc/Backup/CronEdit.html
CHANGED
@@ -165,6 +165,16 @@ already exist in the crontab they are overridden.</p>
|
|
165
165
|
<dd class="description"><p>Temporary file that holds the entries to be written to the crontab</p>
|
166
166
|
|
167
167
|
|
168
|
+
<dt id="POST_COMMENT">POST_COMMENT
|
169
|
+
|
170
|
+
<dd class="description"><p>Post comment after the entered command</p>
|
171
|
+
|
172
|
+
|
173
|
+
<dt id="PRE_COMMENT">PRE_COMMENT
|
174
|
+
|
175
|
+
<dd class="description"><p>Pre comment before the entered command</p>
|
176
|
+
|
177
|
+
|
168
178
|
</dl>
|
169
179
|
</section>
|
170
180
|
|
@@ -198,7 +208,7 @@ and the application exits</p>
|
|
198
208
|
|
199
209
|
|
200
210
|
<div class="method-source-code" id="add_command-source">
|
201
|
-
<pre><span class="ruby-comment"># File lib/backup/cron_edit.rb, line
|
211
|
+
<pre><span class="ruby-comment"># File lib/backup/cron_edit.rb, line 25</span>
|
202
212
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">add_command</span>(<span class="ruby-identifier">command</span>, <span class="ruby-identifier">environment</span>=[])
|
203
213
|
<span class="ruby-identifier">command</span> = <span class="ruby-identifier">command</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">squeeze</span>(<span class="ruby-string">" "</span>)
|
204
214
|
|
@@ -224,7 +234,9 @@ and the application exits</p>
|
|
224
234
|
<span class="ruby-keyword">end</span>
|
225
235
|
|
226
236
|
<span class="ruby-keyword">unless</span> <span class="ruby-identifier">entries</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">command</span>
|
237
|
+
<span class="ruby-identifier">entries</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">PRE_COMMENT</span>
|
227
238
|
<span class="ruby-identifier">entries</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">command</span>
|
239
|
+
<span class="ruby-identifier">entries</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">POST_COMMENT</span>
|
228
240
|
|
229
241
|
<span class="ruby-identifier">cron_entries_file</span> = <span class="ruby-constant">CRON_ENTRIES_FILE</span>
|
230
242
|
<span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">cron_entries_file</span>, <span class="ruby-string">'w'</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
|
@@ -275,7 +287,7 @@ after the values have been written to crontab</p>
|
|
275
287
|
|
276
288
|
|
277
289
|
<div class="method-source-code" id="cleanup-source">
|
278
|
-
<pre><span class="ruby-comment"># File lib/backup/cron_edit.rb, line
|
290
|
+
<pre><span class="ruby-comment"># File lib/backup/cron_edit.rb, line 132</span>
|
279
291
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">cleanup</span>
|
280
292
|
<span class="ruby-constant">File</span>.<span class="ruby-identifier">delete</span> <span class="ruby-constant">CRON_ENTRIES_FILE</span> <span class="ruby-keyword">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span> <span class="ruby-constant">CRON_ENTRIES_FILE</span>
|
281
293
|
<span class="ruby-keyword">end</span></pre>
|
@@ -310,7 +322,7 @@ crontab call fails the error message and exit status of
|
|
310
322
|
|
311
323
|
|
312
324
|
<div class="method-source-code" id="remove_command-source">
|
313
|
-
<pre><span class="ruby-comment"># File lib/backup/cron_edit.rb, line
|
325
|
+
<pre><span class="ruby-comment"># File lib/backup/cron_edit.rb, line 82</span>
|
314
326
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">remove_command</span>(<span class="ruby-identifier">command</span>)
|
315
327
|
<span class="ruby-identifier">command</span> = <span class="ruby-identifier">command</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">squeeze</span>(<span class="ruby-string">" "</span>)
|
316
328
|
|
@@ -332,9 +344,11 @@ crontab call fails the error message and exit status of
|
|
332
344
|
|
333
345
|
<span class="ruby-identifier">entries</span> = <span class="ruby-identifier">stdout</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp">%r\n/</span>).<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">entry</span><span class="ruby-operator">|</span> <span class="ruby-identifier">entry</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">squeeze</span>(<span class="ruby-string">" "</span>)}
|
334
346
|
|
347
|
+
<span class="ruby-identifier">entries</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-constant">PRE_COMMENT</span>)
|
335
348
|
<span class="ruby-identifier">entries</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">command</span>)
|
349
|
+
<span class="ruby-identifier">entries</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-constant">POST_COMMENT</span>)
|
336
350
|
|
337
|
-
<span class="ruby-identifier">cron_entries_file</span> = <span class="ruby-constant">CRON_ENTRIES_FILE</span>
|
351
|
+
<span class="ruby-identifier">cron_entries_file</span> = <span class="ruby-constant">CRON_ENTRIES_FILE</span>
|
338
352
|
|
339
353
|
<span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">cron_entries_file</span>, <span class="ruby-string">'w'</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span>
|
340
354
|
<span class="ruby-identifier">entries</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">entry</span><span class="ruby-operator">|</span> <span class="ruby-identifier">file</span>.<span class="ruby-identifier">puts</span> <span class="ruby-identifier">entry</span>}
|
data/doc/README_rdoc.html
CHANGED
@@ -115,28 +115,43 @@ command is added to crontab.</p>
|
|
115
115
|
<p><a href="Backup.html">Backup</a> a database to the default folder
|
116
116
|
_~/backup_</p>
|
117
117
|
|
118
|
-
<pre>$
|
118
|
+
<pre>$ sycbackup -d database -uuser -ppass</pre>
|
119
119
|
|
120
120
|
<p><a href="Backup.html">Backup</a> a MySQL database, a directory and files to
|
121
121
|
the default folder</p>
|
122
122
|
|
123
|
-
<pre>$
|
123
|
+
<pre>$ sycbackup -d database -uuser -ppass -f directory,file1,file2</pre>
|
124
124
|
|
125
125
|
<p>Specify a backup folder</p>
|
126
126
|
|
127
|
-
<pre>$
|
127
|
+
<pre>$ sycbackup backup/folder -d database -uuser -ppass -f directory,file1,file2</pre>
|
128
128
|
|
129
129
|
<p>Override files in the backup folder if they exist</p>
|
130
130
|
|
131
|
-
<pre>$
|
131
|
+
<pre>$ sycbackup backup/folder --override -f directory,file1,file2</pre>
|
132
132
|
|
133
133
|
<p>Don’t compress the backup</p>
|
134
134
|
|
135
|
-
<pre>$
|
135
|
+
<pre>$ sycbackup --no-compress -f directory,file1,file2</pre>
|
136
136
|
|
137
137
|
<p>Create a cron job that is scheduled every day at 2:30</p>
|
138
138
|
|
139
|
-
<pre>$
|
139
|
+
<pre>$ sycbackup -d database -uuser -ppass -f directory,file1 --cron 30,2,*,*,*</pre>
|
140
|
+
|
141
|
+
<p>If the user or password contains characters as ‘(’ you have to escape them.
|
142
|
+
A password like 123(56 has to be provided with pass"123\\(56".</p>
|
143
|
+
|
144
|
+
<h2 id="label-Usage+of+--override+and+--no-compress">Usage of –override and –no-compress</h2>
|
145
|
+
|
146
|
+
<p>Whether the backup directory and the backup files are time stamped depends
|
147
|
+
how –override and –no-compress is set. The results are shown in the table
|
148
|
+
below.</p>
|
149
|
+
|
150
|
+
<pre>--override --no-compress backup directory backup file(s)
|
151
|
+
0 0 w/o timestamp w/ timestamp
|
152
|
+
1 0 w/o timestamp w/ timestamp
|
153
|
+
0 1 w/ timestamp uncompressed
|
154
|
+
1 1 w/o timestamp uncompressed</pre>
|
140
155
|
|
141
156
|
<h2 id="label-Supported+Platform">Supported Platform</h2>
|
142
157
|
|
@@ -167,6 +182,10 @@ finish. <em>MySQLBackup</em> needs to run a MySQL database with a database
|
|
167
182
|
|
168
183
|
<p>The test files live in the test folder and begin with test_.</p>
|
169
184
|
|
185
|
+
<p>There is a rake file available which can be used to run all tests with</p>
|
186
|
+
|
187
|
+
<pre>$ rake test</pre>
|
188
|
+
|
170
189
|
<h2 id="label-Links">Links</h2>
|
171
190
|
<ul><li><dl class="rdoc-list label-list"><dt><a href="http://sugaryourcoffee.github.com/syc-backup">sugaryourcoffee.github.com/syc-backup</a>
|
172
191
|
<dd><ul><li>
|
data/doc/created.rid
CHANGED
@@ -1,17 +1,17 @@
|
|
1
|
-
|
2
|
-
./README.rdoc
|
1
|
+
Mon, 04 Feb 2013 22:11:40 +0100
|
2
|
+
./README.rdoc Mon, 04 Feb 2013 22:04:33 +0100
|
3
3
|
./test/test_process.rb Sat, 02 Feb 2013 16:04:30 +0100
|
4
4
|
./test/test_mysql_backup.rb Sat, 02 Feb 2013 16:05:39 +0100
|
5
|
-
./test/test_options.rb
|
5
|
+
./test/test_options.rb Mon, 04 Feb 2013 21:31:24 +0100
|
6
6
|
./test/test_cron_edit.rb Sat, 26 Jan 2013 23:41:31 +0100
|
7
7
|
./test/test_environment.rb Sat, 02 Feb 2013 15:56:51 +0100
|
8
8
|
./test/test_file_backup.rb Sat, 02 Feb 2013 16:09:39 +0100
|
9
|
-
./lib/backup_version.rb
|
9
|
+
./lib/backup_version.rb Mon, 04 Feb 2013 22:05:10 +0100
|
10
10
|
./lib/backup/file_backup.rb Sat, 02 Feb 2013 17:58:42 +0100
|
11
|
-
./lib/backup/process.rb Mon,
|
11
|
+
./lib/backup/process.rb Mon, 04 Feb 2013 21:15:51 +0100
|
12
12
|
./lib/backup/mysql_backup.rb Sun, 27 Jan 2013 22:30:18 +0100
|
13
|
-
./lib/backup/options.rb
|
14
|
-
./lib/backup/cron_edit.rb Sat, 02 Feb 2013
|
13
|
+
./lib/backup/options.rb Mon, 04 Feb 2013 21:37:20 +0100
|
14
|
+
./lib/backup/cron_edit.rb Sat, 02 Feb 2013 21:17:07 +0100
|
15
15
|
./lib/backup/environment.rb Sat, 02 Feb 2013 15:55:40 +0100
|
16
16
|
./lib/backup/runner.rb Sat, 02 Feb 2013 15:29:54 +0100
|
17
17
|
./bin/sycbackup Sun, 27 Jan 2013 13:07:36 +0100
|
data/doc/table_of_contents.html
CHANGED
@@ -33,6 +33,7 @@
|
|
33
33
|
<li><a href="README_rdoc.html#label-Backup+utility+for+database%2C+folders+and+files">Backup utility for database, folders and files</a>
|
34
34
|
<li><a href="README_rdoc.html#label-Install">Install</a>
|
35
35
|
<li><a href="README_rdoc.html#label-Usage">Usage</a>
|
36
|
+
<li><a href="README_rdoc.html#label-Usage+of+--override+and+--no-compress">Usage of –override and –no-compress</a>
|
36
37
|
<li><a href="README_rdoc.html#label-Supported+Platform">Supported Platform</a>
|
37
38
|
<li><a href="README_rdoc.html#label-Notes">Notes</a>
|
38
39
|
<li><a href="README_rdoc.html#label-Tests">Tests</a>
|
data/lib/backup/options.rb
CHANGED
@@ -25,6 +25,9 @@ module Backup
|
|
25
25
|
# Determines whether to compress the backup if not to compress it returns
|
26
26
|
# false, otherwise true
|
27
27
|
attr_reader :no_compress
|
28
|
+
# Specifies the maximum backup files to keep. Count < 1 means infinite
|
29
|
+
# backup files
|
30
|
+
attr_reader :max_backups
|
28
31
|
|
29
32
|
# Takes the arguments from the command line and parses them
|
30
33
|
def initialize(argv)
|
@@ -158,6 +161,12 @@ module Backup
|
|
158
161
|
@cron = validate_cron_values c.split(/ /).slice(0..4)
|
159
162
|
end
|
160
163
|
|
164
|
+
opts.on("-m", "--max-backups COUNT", Integer,
|
165
|
+
"The maximum compressed backup files count",
|
166
|
+
"to keep") do |m|
|
167
|
+
@max_backups = m
|
168
|
+
end
|
169
|
+
|
161
170
|
opts.on("-v", "--version", "Show version") do |v|
|
162
171
|
puts Backup::VERSION
|
163
172
|
exit 0
|
data/lib/backup/process.rb
CHANGED
@@ -14,11 +14,12 @@ module Backup
|
|
14
14
|
# provided the files in the backup folder are overridden. no_compress will
|
15
15
|
# prevent compressing the backed up files and will just copy them to the
|
16
16
|
# provided backup folder
|
17
|
-
def initialize(backup_folder, files, override, no_compress)
|
17
|
+
def initialize(backup_folder, files, override, no_compress, max_backups = 9)
|
18
18
|
@backup_folder = backup_folder
|
19
19
|
@files = files
|
20
20
|
@override = override
|
21
21
|
@no_compress = no_compress
|
22
|
+
@max_backups = max_backups
|
22
23
|
end
|
23
24
|
|
24
25
|
# Creates the backup of the database and the files. If at least one of the
|
@@ -36,14 +37,43 @@ module Backup
|
|
36
37
|
|
37
38
|
if @no_compress
|
38
39
|
copy_files
|
40
|
+
delete_uncompressed_backups
|
39
41
|
else
|
40
42
|
compress_files_and_copy
|
43
|
+
delete_compressed_backups
|
41
44
|
end
|
42
45
|
|
43
46
|
end
|
44
47
|
|
45
48
|
private
|
46
49
|
|
50
|
+
# Checks if the compressed backups exceed the max backups denoted by
|
51
|
+
# @max_backups and respectively deletes the oldest files to meet the
|
52
|
+
# @max_backups count. @max_backups less than 1 is equivalent to infinite
|
53
|
+
# backup count, so no files will be deleted and 0 is returned otherwise
|
54
|
+
# the count of files deleted is returned.
|
55
|
+
def delete_compressed_backups
|
56
|
+
return 0 if @max_backups < 1
|
57
|
+
|
58
|
+
pattern = "#{@backup_folder}*-*_syc-backup.tar.gz"
|
59
|
+
files = Dir.glob(pattern).sort_by {|f| File.mtime(f)}
|
60
|
+
|
61
|
+
file_count_to_delete = [0, files.count-@max_backups].max
|
62
|
+
return 0 if file_count_to_delete == 0
|
63
|
+
|
64
|
+
files.first(file_count_to_delete).each {|f| File.delete f}
|
65
|
+
|
66
|
+
file_count_to_delete
|
67
|
+
end
|
68
|
+
|
69
|
+
# Checks if the uncompressed backups exceed the max backups denoted by
|
70
|
+
# @max_backups and respectively deletes the oldest files to meet the
|
71
|
+
# @max_backups count. @max_backups less than 1 is equivalent to infinite
|
72
|
+
# backup count, so no files will be deleted and 0 is returned otherwise
|
73
|
+
# the count of files deleted is returned.
|
74
|
+
def delete_uncompressed_backups
|
75
|
+
end
|
76
|
+
|
47
77
|
# Checks if files to backup have been provided that don't exist. Returns the
|
48
78
|
# inexistent files
|
49
79
|
def check_for_inexistent_files
|
data/lib/backup/runner.rb
CHANGED
@@ -19,7 +19,7 @@ module Backup
|
|
19
19
|
def run
|
20
20
|
if @options.cron
|
21
21
|
create_cron
|
22
|
-
|
22
|
+
elsif @options.database or @options.file
|
23
23
|
create_backup
|
24
24
|
end
|
25
25
|
end
|
@@ -42,6 +42,7 @@ module Backup
|
|
42
42
|
' -u' + @options.user +
|
43
43
|
' -p' + @options.password if @options.database
|
44
44
|
command += ' -f ' + @options.files.join(',') if @options.files
|
45
|
+
command += ' -m ' + @options.max_backups if @options.max_backups
|
45
46
|
command += ' --no-compress' if @options.no_compress
|
46
47
|
command += ' --override' if @options.override
|
47
48
|
|
@@ -66,7 +67,8 @@ module Backup
|
|
66
67
|
process = Process.new(@options.backup_folder,
|
67
68
|
files,
|
68
69
|
@options.override,
|
69
|
-
@options.no_compress
|
70
|
+
@options.no_compress,
|
71
|
+
@options.max_backups)
|
70
72
|
process.backup
|
71
73
|
puts "--> backed up files"
|
72
74
|
puts " #{files.join("\n ")}"
|
data/lib/backup_version.rb
CHANGED
Binary file
|
data/sycbackup.gemspec
CHANGED
@@ -4,8 +4,7 @@ require 'backup_version'
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "syc-backup"
|
6
6
|
s.summary = %q{Back up a database and files}
|
7
|
-
s.description =
|
8
|
-
for backup}
|
7
|
+
s.description = File.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
|
9
8
|
s.requirements = ['No requirements']
|
10
9
|
s.version = Backup::VERSION
|
11
10
|
s.author = "Pierre Sugar"
|
data/test/test_process.rb
CHANGED
@@ -19,6 +19,7 @@ class TestProcess < Test::Unit::TestCase
|
|
19
19
|
def teardown
|
20
20
|
@files.each {|f| File.delete f}
|
21
21
|
Dir["test/backup_p/*"].each {|f| File.delete f if File.file? f}
|
22
|
+
FileUtils.remove_dir "test/backup_p" if File.exists? "test/backup_p"
|
22
23
|
end
|
23
24
|
|
24
25
|
should "backup files to provided folder without compressing" do
|
@@ -35,6 +36,35 @@ class TestProcess < Test::Unit::TestCase
|
|
35
36
|
assert_equal 1, Dir["test/backup_p/*.tar.gz"].size
|
36
37
|
end
|
37
38
|
|
39
|
+
should "delete backups according to --max-backups" do
|
40
|
+
pro = Backup::Process.new("test/backup_p/", @files, false, false, 3)
|
41
|
+
4.times.with_index do |i|
|
42
|
+
assert_equal i, Dir["test/backup_p/*.tar.gz"].size
|
43
|
+
pro.backup
|
44
|
+
print "."
|
45
|
+
sleep 1
|
46
|
+
end
|
47
|
+
assert_equal 3, Dir["test/backup_p/*.tar.gz"].size
|
48
|
+
end
|
49
|
+
|
50
|
+
should "don't delete backups due to max backups count < 1" do
|
51
|
+
pro = Backup::Process.new("test/backup_p/", @files, false, false, 0)
|
52
|
+
2.times.with_index do |i|
|
53
|
+
pro.backup
|
54
|
+
print "."
|
55
|
+
sleep 1
|
56
|
+
end
|
57
|
+
assert_equal 2, Dir["test/backup_p/*.tar.gz"].size
|
58
|
+
|
59
|
+
pro = Backup::Process.new("test/backup_p/", @files, false, false, -3)
|
60
|
+
2.times.with_index do |i|
|
61
|
+
pro.backup
|
62
|
+
print "."
|
63
|
+
sleep 1
|
64
|
+
end
|
65
|
+
assert_equal 4, Dir["test/backup_p/*.tar.gz"].size
|
66
|
+
end
|
67
|
+
|
38
68
|
end
|
39
69
|
|
40
70
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: syc-backup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,17 +9,51 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-02-
|
12
|
+
date: 2013-02-07 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
|
-
description: ! "
|
15
|
-
backup
|
14
|
+
description: ! "= Backup utility for database, folders and files\nBacks up a MySQL
|
15
|
+
database, folders and files to a default folder (~/backup) or to a specified folder.
|
16
|
+
If the --cron switch is provided the specified database and files are not backed
|
17
|
+
up rather a cron job of the provided command is added to crontab.\n\n== Install\nThe
|
18
|
+
application can be installed with\n $ gem install syc-backup\n\n== Usage\nBackup
|
19
|
+
a database to the default folder _~/backup_\n $ sycbackup -d database -uuser
|
20
|
+
-ppass\n\nBackup a MySQL database, a directory and files to the default folder\n
|
21
|
+
\ $ sycbackup -d database -uuser -ppass -f directory,file1,file2\n\nSpecify a
|
22
|
+
backup folder\n $ sycbackup backup/folder -d database -uuser -ppass -f directory,file1,file2\n\nOverride
|
23
|
+
files in the backup folder if they exist\n $ sycbackup backup/folder --override
|
24
|
+
-f directory,file1,file2\n\nDon't compress the backup\n $ sycbackup --no-compress
|
25
|
+
-f directory,file1,file2\n\nCreate a cron job that is scheduled every day at 2:30\n
|
26
|
+
\ $ sycbackup -d database -uuser -ppass -f directory,file1 --cron 30,2,*,*,*\n\nIf
|
27
|
+
the user or password contains characters as '(' you have to escape\nthem. A password
|
28
|
+
like 123(56 has to be provided with pass\\\"123\\(56\\\".\n\n== Usage of --override
|
29
|
+
and --no-compress\nWhether the backup directory and the backup files are time stamped
|
30
|
+
depends how\n--override and --no-compress is set. The results are shown in the table
|
31
|
+
below.\n\n --override --no-compress backup directory backup file(s)\n
|
32
|
+
\ 0 0 w/o timestamp w/ timestamp\n 1
|
33
|
+
\ 0 w/o timestamp w/ timestamp\n 0 1
|
34
|
+
\ w/ timestamp uncompressed\n 1 1 w/o
|
35
|
+
timestamp uncompressed\n\n== Supported Platform\nsyc-backup has been tested
|
36
|
+
with 1.9.3\n\n== Notes\nThe application backs up the MySQL database with _mysqldump_.
|
37
|
+
The dumpfile has the form yyyymmdd-HHMMSS_databasename.sql. After the files are
|
38
|
+
backed up the dumpfile will be deleted.\n\nIf the --no-compress is provided the
|
39
|
+
files are copied to the backup folder. Otherwise they are compressed with _tar cfz
|
40
|
+
YYYYmmdd-HHMMSS_syc-backup.tar.gz_.\n\nIf the --override switch is not provided
|
41
|
+
the backup directory will be added a timestamp. So if you create a cron job you
|
42
|
+
should every now and then delete obsolete backup folders.\n\nThe source contains
|
43
|
+
lib/backup/file_backup.rb which is not used in the application.\n \n== Tests\nThe
|
44
|
+
tests create folders and files and will be deleted after the tests finish. _MySQLBackup_
|
45
|
+
needs to run a MySQL database with a database _test_ and a user _user_ with the
|
46
|
+
password _pass_.\n\nThe test files live in the test folder and begin with test_.\n\nThere
|
47
|
+
is a rake file available which can be used to run all tests with\n $ rake test\n\n==
|
48
|
+
Links\n* [http://sugaryourcoffee.github.com/syc-backup] - RubyDoc\n* [http://www.github.com/sugaryourcoffee/syc-backup]
|
49
|
+
- Source code on GitHub\n* [http://syc.dyndns.org/drupal/content/backup-drupal-database]
|
50
|
+
- Development notebook\n* [https://rubygems.org/gems/syc-backup] - RubyGems\n"
|
16
51
|
email: pierre@sugaryourcoffee.de
|
17
52
|
executables:
|
18
53
|
- sycbackup
|
19
54
|
extensions: []
|
20
55
|
extra_rdoc_files: []
|
21
56
|
files:
|
22
|
-
- syc-backup-0.0.5.gem
|
23
57
|
- README.rdoc
|
24
58
|
- test/test_process.rb
|
25
59
|
- test/test_mysql_backup.rb
|
@@ -86,6 +120,7 @@ files:
|
|
86
120
|
- doc/rdoc.css
|
87
121
|
- doc/TestMySQLBackup.html
|
88
122
|
- doc/TestOptions.html
|
123
|
+
- syc-backup-0.0.6.gem
|
89
124
|
- bin/sycbackup
|
90
125
|
- Rakefile
|
91
126
|
homepage: http://syc.dyndns.org/drupal
|