2d816e0d931cc91d49d85d8c1838710213fd7dcf
- Author
- Damon Timm <damontimm@gmail.com>
- Committer
- Damon Timm <damontimm@gmail.com>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/CHANGELOG b/CHANGELOG
2new file mode 100644
3index 0000000000000000000000000000000000000000..5cecf5fa97ea1d9ab5c1b3e72f0c6b35e5774820
4--- /dev/null
5+++ b/CHANGELOG
6@@ -0,0 +1,22 @@
7+Version Three (01/31/09)
8+
9+ 1. Added comment to explain why folks need to use s3+ and not s3: for Amazon buckets
10+ 2. Used "unset" to remove the variables at end of the script
11+ 3. Fixed a problem when the backup folder on S3 was nested inside another bucket
12+ 4. Changed the PASSPHRASE field to default to the actual passphrase, so one can easily backup the entire script and not have to worry about the passphrase.
13+ 5. Added --backup-this-script option which will turn the script and the secret key into an encrypted tarball that can be kept somewhere safe for easy restores if the machine goes down.
14+ 6. Cleaned up the get_file_size function so it wouldn't run when it wasn't supposed to.
15+
16+Version Two (12/03/08)
17+
18+ 1. added GPL license
19+ 2. changed the cleanup feature to automatically force a full backup after (n) number of days as well as automatically cleanup after (n) number of days
20+ 3. added option to force cleanup after (n) number of full backups (rather than by days)
21+ 4. option to changed log file ownership
22+ 5. runtime checks for installed required software and write permissions on log directory
23+ 6. fixed formatting of logfile to be a little more consistent
24+ 7. setup everything in clever functions
25+
26+Version One (11/24/08)
27+
28+ 1. Initial release.
29diff --git a/DT-S3-Backup-v3.sh b/DT-S3-Backup-v3.sh
30new file mode 100644
31index 0000000000000000000000000000000000000000..6331c232dba4f86136c6c0cc5d0338d6e7d0cca5
32--- /dev/null
33+++ b/DT-S3-Backup-v3.sh
34@@ -0,0 +1,351 @@
35+#!/bin/bash
36+#
37+# Copyright (c) 2008-2009 Damon Timm.
38+#
39+# This program is free software: you can redistribute it and/or modify
40+# it under the terms of the GNU General Public License as published by
41+# the Free Software Foundation, either version 3 of the License, or
42+# (at your option) any later version.
43+#
44+# This program is distributed in the hope that it will be useful,
45+# but WITHOUT ANY WARRANTY; without even the implied warranty of
46+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
47+# GNU General Public License for more details.
48+#
49+# You should have received a copy of the GNU General Public License
50+# along with this program. If not, see <http://www.gnu.org/licenses/>.
51+#
52+# ---------------------------------------------------------------------
53+#
54+# Version 3 - Jan 31 2009
55+# Incremental Encrypted Backups with Duplicity and Amazon S3
56+#
57+# This bash script was designed to automate and simplify the remote backup
58+# process using duplicity and Amazon S3. Hopefully, after the script is
59+# configured, you can easily backup, restore, verify and clean without
60+# having to remember lots of different command options.
61+#
62+# Furthermore, you can even automate the process of saving your script
63+# and the gpg key for your backups in a single password-protected file --
64+# this way, you know you have everything you need for a restore,
65+# in case your machine goes down.
66+#
67+# You can run the script from cron with no command-line options
68+# (all options set in the script itself); however, you can also run it
69+# outside of the cron with some variables for more control.
70+#
71+# --full: forces a full backup (instead of waiting specified number of days
72+# --verify: verifies the backup (no cleanup is run)
73+# --restore: restores the backup to the directory specified in the script
74+# --backup-this-script: let's you backup the script and secret key to the
75+# current working directory.
76+#
77+# See more info about the script online at:
78+# blog.damontimm.com/bash-script-incremental-encrypted-backups-duplicity-amazon-s3/
79+
80+# TO DO:
81+# - allow command line restore options (specific files, etc)
82+# - allow command line cleanup options (# of days [30D] or full backups [2])
83+# - allow restore to specific path from the command line
84+
85+# AMAZON S3 INFORMATION
86+export AWS_ACCESS_KEY_ID="<FOOBAR>"
87+export AWS_SECRET_ACCESS_KEY="<FOOBAR>"
88+
89+# GPG PASSPHRASE & GPG KEY (Automatic/Cron Usage)
90+# If you aren't running this from a cron, comment this line out
91+# and duplicity should prompt you for your password.
92+# I put my GPG passphrase in a text file at
93+# ~/.gnupg/.gpg-passphrase and chmod it 0600.
94+export PASSPHRASE="<FOOBAR>"
95+GPG_KEY="<FOOBAR>"
96+
97+# The ROOT of your backup (where you want the backup to start);
98+# This can be / or somwhere else -- I use /home/ because all the
99+# directories start with /home/ that I want to backup.
100+ROOT="/home/"
101+
102+# BACKUP DESTINATION INFORMATION
103+# In my case, I use Amazon S3 use this - so I made up a unique
104+# bucket name (you don't have to have one created, it will do it
105+# for you. If you don't want to use Amazon S3, you can backup
106+# to a file or any of duplicity's supported outputs.
107+#
108+# NOTE: You do need to keep the "s3+http://<your location>/" format;
109+# even though duplicity supports "s3://<your location>/" this script
110+# needs to read the former.
111+#DEST="file:///home/damon/new-backup-test/"
112+DEST="s3+http://backup-bucket/backup-folder/"
113+
114+# RESTORE FOLDER
115+# Being ready to restore is important to me, so I have this script
116+# setup to easily be able to restore a backup by adding the
117+# "--restore" flag. Indicate where you want the fili to restore to
118+# here so you're ready to go.
119+RESTORE="/home/damon/restore-backup-01"
120+
121+# INCLUDE LIST OF DIRECTORIES
122+# Here is a list of directories to include; if you want to include
123+# everything that is in root, you could leave this list empty, I think.
124+#INCLIST=( "/home/*/Documents" \
125+# "/home/*/Projects" \
126+# "/home/*/logs" \
127+# "/home/www/mysql-backups" \
128+# )
129+
130+INCLIST=( "/home/damon/Documents/Scripts/" ) # small dir for testing
131+
132+# EXCLUDE LIST OF DIRECTORIES
133+# Even though I am being specific about what I want to include,
134diff --git a/LICENSE b/LICENSE
135new file mode 100644
136index 0000000000000000000000000000000000000000..94a9ed024d3859793618152ea559a168bbcbb5e2
137--- /dev/null
138+++ b/LICENSE
139@@ -0,0 +1,674 @@
140+ GNU GENERAL PUBLIC LICENSE
141+ Version 3, 29 June 2007
142+
143+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
144+ Everyone is permitted to copy and distribute verbatim copies
145+ of this license document, but changing it is not allowed.
146+
147+ Preamble
148+
149+ The GNU General Public License is a free, copyleft license for
150+software and other kinds of works.
151+
152+ The licenses for most software and other practical works are designed
153+to take away your freedom to share and change the works. By contrast,
154+the GNU General Public License is intended to guarantee your freedom to
155+share and change all versions of a program--to make sure it remains free
156+software for all its users. We, the Free Software Foundation, use the
157+GNU General Public License for most of our software; it applies also to
158+any other work released this way by its authors. You can apply it to
159+your programs, too.
160+
161+ When we speak of free software, we are referring to freedom, not
162+price. Our General Public Licenses are designed to make sure that you
163+have the freedom to distribute copies of free software (and charge for
164+them if you wish), that you receive source code or can get it if you
165+want it, that you can change the software or use pieces of it in new
166+free programs, and that you know you can do these things.
167+
168+ To protect your rights, we need to prevent others from denying you
169+these rights or asking you to surrender the rights. Therefore, you have
170+certain responsibilities if you distribute copies of the software, or if
171+you modify it: responsibilities to respect the freedom of others.
172+
173+ For example, if you distribute copies of such a program, whether
174+gratis or for a fee, you must pass on to the recipients the same
175+freedoms that you received. You must make sure that they, too, receive
176+or can get the source code. And you must show them these terms so they
177+know their rights.
178+
179+ Developers that use the GNU GPL protect your rights with two steps:
180+(1) assert copyright on the software, and (2) offer you this License
181+giving you legal permission to copy, distribute and/or modify it.
182+
183+ For the developers' and authors' protection, the GPL clearly explains
184+that there is no warranty for this free software. For both users' and
185+authors' sake, the GPL requires that modified versions be marked as
186+changed, so that their problems will not be attributed erroneously to
187+authors of previous versions.
188+
189+ Some devices are designed to deny users access to install or run
190+modified versions of the software inside them, although the manufacturer
191+can do so. This is fundamentally incompatible with the aim of
192+protecting users' freedom to change the software. The systematic
193+pattern of such abuse occurs in the area of products for individuals to
194+use, which is precisely where it is most unacceptable. Therefore, we
195+have designed this version of the GPL to prohibit the practice for those
196+products. If such problems arise substantially in other domains, we
197+stand ready to extend this provision to those domains in future versions
198+of the GPL, as needed to protect the freedom of users.
199+
200+ Finally, every program is threatened constantly by software patents.
201+States should not allow patents to restrict development and use of
202+software on general-purpose computers, but in those that do, we wish to
203+avoid the special danger that patents applied to a free program could
204+make it effectively proprietary. To prevent this, the GPL assures that
205+patents cannot be used to render the program non-free.
206+
207+ The precise terms and conditions for copying, distribution and
208+modification follow.
209+
210+ TERMS AND CONDITIONS
211+
212+ 0. Definitions.
213+
214+ "This License" refers to version 3 of the GNU General Public License.
215+
216+ "Copyright" also means copyright-like laws that apply to other kinds of
217+works, such as semiconductor masks.
218+
219+ "The Program" refers to any copyrightable work licensed under this
220+License. Each licensee is addressed as "you". "Licensees" and
221+"recipients" may be individuals or organizations.
222+
223+ To "modify" a work means to copy from or adapt all or part of the work
224+in a fashion requiring copyright permission, other than the making of an
225+exact copy. The resulting work is called a "modified version" of the
226+earlier work or a work "based on" the earlier work.
227+
228+ A "covered work" means either the unmodified Program or a work based
229+on the Program.
230+
231+ To "propagate" a work means to do anything with it that, without
232+permission, would make you directly or secondarily liable for
233+infringement under applicable copyright law, except executing it on a
234+computer or modifying a private copy. Propagation includes copying,
235+distribution (with or without modification), making available to the
236+public, and in some countries other activities as well.
237+
238+ To "convey" a work means any kind of propagation that enables other