backup server on Debian squeeze Remastersys

Today I will tell you how to make a backup server on debian 6 is a hot topic for each system administrator (without this no where)!
and so, we panadobâtsâ brand new repositories are doing here is that …
open for editing the file
/etc/apt/sources.list
Add the following
deb http://www.geekconnection.org/remastersys/repository squeeze/
apt-get update
and install the software
apt-get install remastersys
After installation, see config file I have a little bit of it
/etc/remastersys.conf
Opportunities out there a little bit, but you can improve.
Now about using.
Backup-creates a full backup of the system (including the folder user settings/home/);
cleanremoves temporary files, which are formed in the process of creating a distribution package. The correct thing. Saves space, but if you do not copy the image somewhere of the distribution, which has turned out-he too is deleted;
Distcreate your image. The same as the backup, but without copying user data from your/home;
CDFScreate a file with the file system without creating ISO image (ideal if you want to create an ISO image of another program);
ISO is used by default, creates an ISO image distro;
[filename.iso]last parameter specifies the name of the ISO image file is placed in the directory/home/remastersys.
Next we need to create a startup script to create the backup, the backup folders that are needed can be added to the config files and so on
First, we create a file that will be our mighty script. Simple but very good.
I have all those backups will throw off the puller and there’s also going to create this script
touch/media/windows/backup.sh
Next, create a folder where the backups will be stored
mkdir/media/windows/backups
This is for SQUID
mkdir/media/windows/backups/squid/
This is for SAMBA
mkdir/media/windows/backups/samba/
This is for web folders
mkdir/media/windows/backups/www/
This is for database dump
mkdir/media/windows/backups/mysql/
Это для бэкапа всей системы целиком в ISO образ, чтобы в случае чего можно было все снести и накатить заново
mkdir/media/windows/backups/system-iso/
Делаем скрипт его исполняемым:
chmod-x/media/windows/backup.sh
Далее открываем его на редактирование/backup.sh и пишем примерно следующее:
#!/bin/bash
# префикс с датой
Date_pref = ‘ date +%F ‘
# В переменной BACKUP_xxx_DIR лежит путь, куда будет сохраняться бэкап к каталогу с файлами, текущая дата будет браться из переменной DATE_PREF
Backup_home_dir=/media/windows/homes/$date_pref
Backup_samba_dir=/media/windows/samba/$date_pref
Backup_mysql_dir=/media/windows/bd/$date_pref
Backup_www_dir=/media/windows/www/$date_pref
# ищем файлы старше 7 суток и удаляем их, дабы не засорять жесткий диск
find/media/windows/homes/-mtime + 7-print-mindepth 1-delete >/dev/null 2>&1 2>>/var/log/backup.log
find/media/windows/samba/-mtime + 7-print-mindepth 1-delete >/dev/null 2>&1 2>>/var/log/backup.log
find/media/windows/bd/-mtime + 7-print-mindepth 1-delete >/dev/null 2>&1 2>>/var/log/backup.log
find/media/windows/www/-mtime + 7-print-mindepth 1-delete >/dev/null 2>&1 2>>/var/log/backup.log
# Удаляем старые бэкапы системы, чтобы не плодить лишние
find/media/windows/iso/system-iso/install-mtime + 7-print-mindepth 1-delete >/dev/null 2>&1 2>>/var/log/backup.log
# создаем tar ‘ ом
tar cpzf $BACKUP_HOME_DIR\-home_users.zip/home/>/dev/null 2>&1 2>>/var/log/backup.log
tar cpzf $BACKUP_SAMBA_DIR\-samba.zip/etc/samba/>/dev/null 2>&1 2>>/var/log/backup.log
tar cpzf $BACKUP_WWW_DIR\-www.zip/var/www/>/dev/null 2>&1 2>>/var/log/backup.log
# создаем дампы баз данных MySQL. Обязательно указываем пользователя и пароль
# Тут же упаковываем gzip-ом
mysqldump-q-u root-pВаш пароль рута-h localhost имя бд которую хотите забэкапить | gzip-c > $BACKUP_MYSQL_DIR\-xxx.sql.gz
mysqldump-q-u root-pВаш пароль рута
# Делаем INSTALL. ISO бэкап с помощью Remastersys
remastersys backup install-$DATE_NOW.iso
# Копируем образ и MD5 отпечаток для сохранности и проверки образа
# Если не скопировать, то при очистке временных файлов образ удалится
cp/home/remastersys/remastersys/install-$DATE_NOW.iso/media/windows/iso/system-iso/install/install-$DATE_NOW.iso
cp/home/remastersys/remastersys/install-$DATE_NOW.iso.md5/media/windows/iso/system-iso/install/install-$DATE_NOW.iso.md5
# Очищаем временные файлы
remastersys clean
Configure remastersys, to do so, open the file/etc/remastersys.conf and make the following changes:
# Specify the directory in which you will create the image
WORKDIR = /home/remastersys
# Exclude Folders. razderitel′-space.
EXCLUDES = /backups
# Name of image
LIVECDLABEL = “Custom Live CD BACKUP”
# The name of the image file
CUSTOMISO = install-$ 1. iso”