Welcome to my Blog!
Information should be free, accurate, and available. I will be updating this section most often, enjoy!
Various galleries of artwork and photography I have done over the last five years.
Mini scripts I have written and decided to share. Mostly oneliners for managing network and system load.
Software projects are in the works and will be here eventually!
You can contact me through various methods.
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}
|
|
|
It is better to die on your feet than to live on your knees.