Mindbend.org

Mindblog

Welcome to my Blog!

Techblog

Information should be free, accurate, and available. I will be updating this section most often, enjoy!

Portfolio

Various galleries of artwork and photography I have done over the last five years.

Scripts

Mini scripts I have written and decided to share. Mostly oneliners for managing network and system load.

Mindware

Software projects are in the works and will be here eventually!

Contact

You can contact me through various methods.

Asterisk Backup Script

This script is designed to backup all of the Asterisk files in case of a complete system blowout. The locations are setup around the Asterisk CentOS release using the voicemail system. There are two more databases included (astvm and astlogger) which I have created for my own purposes. These were left here to show you how to create a functional array of databases to backup.

#!/bin/bash

# 0 3 * * * /backup/bin/ast_backup.sh > /dev/null 2>&1

STAMP=`date +"%F"`;
EPOCH=`date +"%s"`;

TMPBKDIR=/backup/.tmp/
BKDIR=/backup/

BACKUPFOLDERS=(/etc/asterisk /etc/firewall /etc/init.d /var/spool/asterisk \
    /var/log/asterisk /var/www/html /var/lib/asterisk /usr/lib/asterisk)
DBNAMES=(mysql astvm astlogger asterisk)

DBUSER=root
DBPASS=password

[ -d $BKDIR ] || mkdir $BKDIR
[ -d $TMPBKDIR ] || mkdir $TMPBKDIR

for folders in ${BACKUPFOLDERS[@]}
 do
  mkdir -p ${TMPBKDIR}${STAMP}${folders}
  cp -r $folders ${TMPBKDIR}${STAMP}${folders}
 done

for i in ${DBNAMES[@]}
 do
   mkdir ${TMPBKDIR}${STAMP}/var/lib/mysql/
   mysqldump -u${DBUSER} -p${DBPASS} ${i} > ${TMPBKDIR}${STAMP}/var/lib/mysql/${i}.sql
 done

rm -rf ${BKDIR}${STAMP}-${EPOCH}-asterisk.tar.gz
cd ${TMPBKDIR}
tar -czf ${STAMP}-${EPOCH}-asterisk.tar.gz ${STAMP}
mv ${STAMP}-${EPOCH}-asterisk.tar.gz ${BKDIR}
rm -rf ${TMPBKDIR}${STAMP}








































Asterisk Backup Script
Mysql Backup Script
Written by:Robert Church
Published on:05-14-2010

Quick Byte

If someone says "I don't believe in labels," what he usually means is
"the other side should give up its ideological objections in favor of
my ideological objectives." This is an attempt at rhetorical alchemy
by transmuting a political agenda into a "pragmatic" one.
-- Jonah Goldberg