bb3c55b8f8d6169ae522064bf902a27a5b94a0d2
- Author
- Razvan Marescu <rmarescu@gmail.com>
- Committer
- Razvan Marescu <rmarescu@gmail.com>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/0001-New-feature-email-alert-using-mailx.patch b/0001-New-feature-email-alert-using-mailx.patch
2deleted file mode 100644
3index 6a5b504d961374d9dd2847a37c314b948eee14c8..0000000000000000000000000000000000000000
4--- a/0001-New-feature-email-alert-using-mailx.patch
5+++ /dev/null
6@@ -1,109 +0,0 @@
7-From 4e00543450cbfc6a25c64b929cc538945f57eacf Mon Sep 17 00:00:00 2001
8-From: Razvan Marescu <rmarescu@gmail.com>
9-Date: Tue, 7 Dec 2010 20:58:50 -0800
10-Subject: [PATCH] New feature - email alert using mailx
11-
12----
13- README | 16 ++++++++++------
14- dt-s3-backup.sh | 24 ++++++++++++++++++++++++
15- 2 files changed, 34 insertions(+), 6 deletions(-)
16-
17-diff --git a/README b/README
18-index 83ec4bb..3cb90bb 100644
19---- a/README
20-+++ b/README
21-@@ -9,7 +9,10 @@ passphrases.
22-
23- Most importantly, you can easily backup the script and your gpg key in a
24- convenient passphrase-encrypted file. This comes in in handy if/when your
25--machine ever does go belly up.
26-+machine ever does go belly up.
27-+
28-+Optionally, you can set up an email address where the log file will be sent.
29-+Useful when the script is used via cron.
30-
31- More information about this script avaiable at:
32- http://damontimm.com/code/dt-s3-backup
33-@@ -35,8 +38,9 @@ REQUIREMENTS
34-
35- * duplicity
36- * gpg
37--* Amazon S3
38-+* Amazon S3
39- * s3cmd (optional)
40-+* mailx (optional)
41-
42- COMMON USAGE EXAMPLES
43- =====================
44-@@ -51,7 +55,7 @@ COMMON USAGE EXAMPLES
45- $ dt-s3-backup.sh --full
46-
47- * Restore your entire backup:
48-- $ dt-s3-backup.sh --restore
49-+ $ dt-s3-backup.sh --restore
50- You will be prompted for a restore directory
51-
52- $ dt-s3-backup.sh --restore /home/user/restore-folder
53-@@ -80,7 +84,7 @@ NEXT VERSION WISH LIST
54- ======================
55-
56- * --restore-dir option
57--* restore files from a specific time period
58--
59-+* restore files from a specific time period
60-+* support multiple MTAs for the email alert feature
61-
62--Thanks to Mario Santagiuliana for his help.
63-+Thanks to Mario Santagiuliana for his help.
64-diff --git a/dt-s3-backup.sh b/dt-s3-backup.sh
65-index 2afd982..e38efa8 100755
66---- a/dt-s3-backup.sh
67-+++ b/dt-s3-backup.sh
68-@@ -100,6 +100,18 @@ LOG_FILE="duplicity-`date +%Y-%m-%d_%H-%M`.txt"
69- LOG_FILE_OWNER="foobar_user_name:foobar_user_name"
70- VERBOSITY="-v3"
71-
72-+# EMAIL ALERT
73-+# Provide an email address to receive the logfile by email. If no email
74-+# address is provided, no alert will be sent.
75-+# You can set a custom from email address and a custom subject (both optionally)
76-+# If no value is provided for the subject, the following value will be
77-+# used by default: "DT-S3 Alert ${LOG_FILE}"
78-+# MTA used: mailx
79-+#EMAIL="admin@example.com"
80-+EMAIL_TO=
81-+EMAIL_FROM=
82-+EMAIL_SUBJECT=
83-+
84- # TROUBLESHOOTING: If you are having any problems running this script it is
85- # helpful to see the command output that is being generated to determine if the
86- # script is causing a problem or if it is an issue with duplicity (or your
87-@@ -114,6 +126,7 @@ VERBOSITY="-v3"
88- LOGFILE="${LOGDIR}${LOG_FILE}"
89- DUPLICITY="$(which duplicity)"
90- S3CMD="$(which s3cmd)"
91-+MAIL="$(which mailx)"
92-
93- NO_S3CMD="WARNING: s3cmd is not installed, remote file \
94- size information unavailable."
95-@@ -419,6 +432,17 @@ fi
96-
97- echo -e "-------- END DT-S3-BACKUP SCRIPT --------\n" >> ${LOGFILE}
98-
99-+if [ $EMAIL_TO ]; then
100-+ if [ ! -x "$MAIL" ]; then
101-+ echo -e "Email coulnd't be sent. mailx not available." >> ${LOGFILE}
102-+ else
103-+ EMAIL_FROM=${EMAIL_FROM:+"-r ${EMAIL_FROM}"}
104-+ EMAIL_SUBJECT=${EMAIL_SUBJECT:="DT-S3 Alert ${LOG_FILE}"}
105-+ ${MAIL} -s """${EMAIL_SUBJECT}""" $EMAIL_FROM ${EMAIL_TO} < ${LOGFILE}