To make this I have googled this stite and found bits and pieces all over, added some myself sjau, falko and mphayesuk is some of the unknown contributors. My problem is to backup daily - thus keeping an per day backup for a week - thus the last 7 days. My focus is to recover from total crash were the server is re-build. therefore i do not care about the /etc folders and because the mail files is volitile and offencive large. so without further chatting. my script that run on Code: crontab -e 45 23 * * * /root/make-backup Code: [root@alpha ~]# vi make-backup Code: #!/bin/bash find /root/ispconfig > /root/backup-files find /home/admispconfig >> /root/backup-files DATE=`date +%Y-%A` BACKUPNAME="use-yr-server-name-here-"$DATE # echo $date # echo $BACKUPNAME USER=root PASSWORD=use-yr-own-password-here HOST=localhost DESTINATION=use-yr-destination-server-fqdn-or-ip-here for i in $(echo 'SHOW DATABASES;' | mysql -u$USER -p$PASSWORD -h$HOST|grep -v '^Database$'); do mysqldump \ -u$USER -p$PASSWORD -h$HOST \ -Q -c -C --add-drop-table --add-locks --quick --lock-tables \ $i > /home/backup/$BACKUPNAME-$i.sql; done; tar cvzf /home/backup/$BACKUPNAME"-backup.tar.gz" --files-from=/root/backup-files --no-recursion /usr/bin/scp /home/backup/$BACKUPNAME* $DESTINATION:/home/backup/ rm /root/backup-files Ok about the ssh, I have set-up ssh to use 1024 bit RSA keys for authentication. this allows the one server to log into the other without user intervention and can be done safely and securely. Aski in this threat if you need the HOWTO If some of you clever people can optimise and improve - please feel free to do so, I'd welcome comment.
Restore Hi, The restore is little more complicated, It normally involves the messaging of the passwd, shadow, group, gshadow files as you have an new install the users made while installing (system and pplication) sometime have different UID and GID's you need to cut the ISPC users out and append that manually to the above files. The rest is rather easier, tar xvfz the tar files and swop them inplace with the existing. e.g. tar the var backup to some place and Code: mv /var/www /var/www.old then Code: mv /someplace/var/www /var/www the problem all have is to restore the sql data. this is actually very strait forward using this syntax Code: mysql -u root -p -e "source /home/backup/hera-2007-Friday-mysql.sql" mysql mysql -u root -p -e "source /home/backup/hera-2007-Friday-db_ispconfig.sql" db_ispconfig Use special care in restoring the mysql database, it might have desasterous results. This database is backed up in case of "Total desasters" This database keep the management info of all the databases including the security of the other databases such as db_ispconfig. Another this is before restoring the databases you need to create and empty one. Code: mysql -u root -p to log in and then Code: create database xyz; and quit, rinse and repeat for each database you have. Also remember to "correct" the database passwords by changing them in the ISPC config {look for this in the ISPC Site, Options) were you originally created it. also see Total Desaster Posting Maybe this posting actually have newer information and include the automatic login between source and destination servers, via ssh using certificates.