|

OpenBSD Support Argentina es un portal de redifucion de los contenidos referidos a este sistema.
Categorias / Categories:
Inicio
Libros
Notas
Eventos
Scripts
Networking
Mirrors OpenBSD
Tutoriales
Videos
Graficas
Banners
Wallpapers
Fotos
Posters
Foro:
Encuentra mas contenido util aqui en el
Foro
Proyectos Asociados
Links
Contactos:
Ponte en contacto
Obtener OpenBSD
Nota: Si usted encuentra que alguna documentación es inservible, inexacta, obsoleta o simplemente esta mal, entonces su ayuda sera bienvenida para que esto sea mejor. Envíe su nuevo documento.
|
Portal de redifusion de sitios amigos de OpenBSD.
Y no se olvide de obtener su CD aquí para apoyar el proyecto!
Shell scripts / backup de sitios web
Objetivo
Si bajo el directorio /vhost tenemos alojados varios dominios, con este script podemos hacer backup de los datos de cada uno de ellos independientemente, y enviar cada backup a una cuenta de correo externa (GMail en este caso) y anotar los datos y tamaño del backup en un blog Blosxom
Script
Script
#!/bin/sh
#####################################################################
# backup_dominios.sh
# $Id: backup.sh,v 1.1.1.1 2006/01/17 18:19:44 jherrero Exp $
#
# Copyright (c) 2006, Joaquin Herrero Pintado
# Some rights reserved.
# This software is licensed under the CC-GNU GPL
# http://creativecommons.org/licenses/GPL/2.0/
#
# If you modify your copy or copies of this program or any portion of
# it, or develop a program based upon it, you may distribute the
# resulting work provided you keep this copyright notice intact and
# distribute your work under the same license.
#
#####################################################################
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin
_ROOTPATH="/vhost"
_DOMINIOS="mydomain.com otherdomain.com somedomain.org"
_EMAIL="mybackup@gmail.com"
# --------------------------------------
# Don't need to modify beyond this point
_SYS="`uname -a`"
_USER=`who am i`
_BLOGENTRY="/blogdata/backups/data.blog"
cd ${_ROOTPATH}
for _DOMINIO in $_DOMINIOS
do
_DATE=`date +%Y%m%d-%H%M%S`
_DOMINIO_BACKUP=${_DOMINIO}.tar.gz
_TEMP=/tmp/back_domains_`date +%Y%m%d-%H%M%S`
echo "Backup DOMINIO" > $_TEMP
echo "--------------\n" >> $_TEMP
df -h >> $_TEMP
df -h >> $_TEMP
echo "\n" >> $_TEMP
echo "Disk Usage" >> $_TEMP
echo "----------" >> $_TEMP
du -sh ${_ROOTPATH}${_DOMINIO} >> $_TEMP
echo "----------" >> $_TEMP
du -sh ${_ROOTPATH}${_DOMINIO}/* >> $_TEMP
echo "\n" >> $_TEMP
echo "Backup Contents" >> $_TEMP
echo "---------------" >> $_TEMP
tar cvfz ${_DOMINIO_BACKUP} ${_DOMINIO} >> $_TEMP
#cat ${_TEMP} | mutt -a $_DOMINIO_BACKUP -s "Backup de $_DOMINIO $_DATE" $_EMAIL
echo "<pre>Backup $_DOMINIO el `date +%d-%m-%Y` a las `date +%H:%M:%S` : `ls -lh $_DOMINIO_BACKUP | awk '{print $5}'` </pre>"
>> $_BLOGENTRY
rm $_DOMINIO_BACKUP
rm $_TEMP
done
Back | Regresar
  OpenBSD Support Argentina se hostea en servidores OpenBSD
Copyright © 2004 - 2008 Alekid. All rights
reserved. Articles and comments are copyright their respective authors.
|