[postfix-es] Script de backups
osmcruzl en gmail.com
osmcruzl en gmail.com
Vie Abr 9 03:27:28 CEST 2010
Hola amigos
quizas este fuera de tema pero les muestro el siguiente de backups de la db
y los buzones de mi servidor postfix, corre ala perfeccion pero el asunto es
q estoy por migrar de servidor y busco un script para realizar un backup de
toda la configuacion de mi sistema, esto para reestablecerlo en momento de
colapsar ...................
espero sus aportes
echo ""
echo " BACKUP file Systems"
echo ""
echo ""
echo " Security copy"
echo "----------------------------------------------"
echo ""
DIR_BACKUP="/media/backups"
DATE=`date +%Y-%m-%d-%H.00`
DATE_OUT=`(date -r $(( $(date +script-security-backup) - (3 * 86400)))
+%Y-%m-%d-%H.00)`
# ---------- DB -------------
#Security copy
echo " -= Data Base =-"
if [ -d "/media/backups/db/db_$DATE" ]; then
echo "Already exist /media/backups/db/db_$DATE"
else
##Backup mysql
echo "Security backup /media/backups/db/db_$DATE"
mkdir /media/backups/db/db_$DATE
chmod 700 /media/backups/db/db_$DATE
cp -Rp /var/lib/mysql/* /media/backups/db/db_$DATE
chmod 700 /media/backups/db/db_$DATE/*
rm /media/backups/db/db_$DATE/ib*
cd /media/backups/db
tar cvzf db_$DATE.tar.gz ./db_$DATE
rm -rf ./db_$DATE
##Backup IMAP
echo "Security backup /media/backups/db/db-imap_$DATE"
mkdir /media/backups/db/db-imap_$DATE
chmod 700 /media/backups/db/db-imap_$DATE
cp -Rp /var/lib/imap/* /media/backups/db/db-imap_$DATE
chmod 700 /media/backups/db/db-imap_$DATE/*
tar cvzf db-imap_$DATE.tar.gz ./db-imap_$DATE
rm -rf ./db-imap_$DATE
##Backup mailbox
echo "Security backup /media/backups/users/users_$DATE"
mkdir /media/backups/users/users_$DATE
chmod 700 /media/backups/users/users_$DATE
cp -Rp /var/spool/imap/user/* /media/backups/users/users_$DATE
chmod 700 /media/backups/users/users_$DATE/*
cd /media/backups/users
tar cvzf users_$DATE.tar.gz ./users_$DATE
rm -rf ./users_$DATE
fi
#Delete old copy
if [ -d "/media/backups/db/db_$DATE_OUT" ]; then
rm -rf /media/backups/db/db_$DATE_OUT
echo "old copy deleted /media/backups/db/db_$DATE_OUT"
fi
echo ""
echo ""
echo ".: Finish :."
echo ""
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: <http://lists.wl0.org/pipermail/postfix-es/attachments/20100408/dcbf034d/attachment.html>
More information about the postfix-es
mailing list