[kwlug-disc] GUI Backup Software

Khalid Baheyeldin kb at 2bits.com
Wed Jun 11 12:58:15 EDT 2014


On Wed, Jun 11, 2014 at 12:37 PM, unsolicited <unsolicited at swiz.ca> wrote:

> The most significant thing I've found with backups is making sure you have
> a good alert mechanism upon failure.


Absolutely. You need to notified that the backup has been run and what is
the outcome of it.


> (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.)


I do that by email, and the logger command. No need for a GUI running or
someone logged in.

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.

So, I have this in backup scripts ...

log_msg() {
  # Log to syslog
  logger -t `basename $0` "$*"

  # Echo to stdout
  LOG_TS=`date +'%H:%M:%S'`
  echo "$LOG_TS - $*"
}

BACKUP_FILE=blah
log_msg "Backing up files and database to $BACKUP_FILE ..."

# Backup command, tar, cpio, dump, rsync, ...etc.
tar -czf $BACKUP_FILE /directory
RC=$?

if [ "$RC" = 0 ]; then
  log_msg "Backup completed successfully ..."
else
  log_msg "Backup exited with return code: $RC"
fi

Now, each step is recorded in /var/log/syslog with the time stamp, and an
email is sent.

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.

Yes, one email per server every day, but it only takes 10 seconds to
visually check it for errors. Better safe than sorry.
-- 
Khalid M. Baheyeldin
2bits.com, Inc.
Fast Reliable Drupal
Drupal optimization, development, customization and consulting.
Simplicity is prerequisite for reliability. --  Edsger W.Dijkstra
Simplicity is the ultimate sophistication. --   Leonardo da Vinci
For every complex problem, there is an answer that is clear, simple, and
wrong." -- H.L. Mencken
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://kwlug.org/pipermail/kwlug-disc_kwlug.org/attachments/20140611/59f19444/attachment.htm>


More information about the kwlug-disc mailing list