<div dir="ltr">On Wed, Jun 11, 2014 at 12:37 PM, unsolicited <span dir="ltr"><<a href="mailto:unsolicited@swiz.ca" target="_blank">unsolicited@swiz.ca</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
The most significant thing I've found with backups is making sure you have a good alert mechanism upon failure. </blockquote><div><br></div><div>Absolutely. You need to notified that the backup has been run and what is the outcome of it.<br>
<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">(For me, success too, as I like to see that it ran - so my scripts put a popup regardless, and the error log in kwrite if there is an error.) </blockquote>
<div><br></div><div>I do that by email, and the logger command. No need for a GUI running or someone logged in.<br><br></div><div>If you have something running from cron, then its stdout goes to an email to root, or to whatever MAILTO= is set to in the crontab file.<br>
<br></div><div>So, I have this in backup scripts ...<br><br></div><code>log_msg() {<br> # Log to syslog<br> logger -t `basename $0` "$*"<br><br> # Echo to stdout<br> LOG_TS=`date +'%H:%M:%S'`<br> echo "$LOG_TS - $*"<br>
}<br><br>BACKUP_FILE=blah<br>log_msg "Backing up files and database to $BACKUP_FILE ..."<br><br></code></div><div class="gmail_quote"><code># Backup command, tar, cpio, dump, rsync, ...etc.<br></code></div><div class="gmail_quote">
<code>tar -czf $BACKUP_FILE /directory<br>RC=$?<br><br>if [ "$RC" = 0 ]; then<br> log_msg "Backup completed successfully ..."<br>else<br> log_msg "Backup exited with return code: $RC"<br>fi</code><div>
<br></div>Now, each step is recorded in /var/log/syslog with the time stamp, and an email is sent.<br><br>You can also capture stderr by enclosing the whole thing in ( ) 2>&1 and output to a file then emailing the file contents in the script.<br>
<br>Yes, one email per server every day, but it only takes 10 seconds to visually check it for errors. Better safe than sorry.<br></div>-- <br>Khalid M. Baheyeldin<br><a href="http://2bits.com" target="_blank">2bits.com</a>, Inc.<br>
Fast Reliable Drupal<br>Drupal optimization, development, customization and consulting.<br>Simplicity is prerequisite for reliability. -- Edsger W.Dijkstra<br>Simplicity is the ultimate sophistication. -- Leonardo da Vinci<br>
For every complex problem, there is an answer that is clear, simple, and wrong." -- H.L. Mencken<br>
</div></div>