Old 4th December 2006, 11:14
Morons Morons is offline
Senior Member
Join Date: Aug 2006
Posts: 199
Thanks: 8
Thanked 15 Times in 7 Posts
Cool Compete Backup script

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

crontab -e
45 23 * * * /root/make-backup
[root@alpha ~]# vi make-backup
find /root/ispconfig > /root/backup-files
find /home/admispconfig >> /root/backup-files
DATE=`date +%Y-%A`
# echo $date

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;

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.
Reply With Quote
The Following User Says Thank You to Morons For This Useful Post:
TobiasTM (18th August 2007)
Sponsored Links
Old 27th July 2007, 13:47
m1_davidson m1_davidson is offline
Junior Member
Join Date: Jul 2007
Posts: 18
Thanks: 1
Thanked 0 Times in 0 Posts

Nice script. I have set it up and it works for backups. Do you have a script for restores?
Reply With Quote
Old 27th July 2007, 15:49
Morons Morons is offline
Senior Member
Join Date: Aug 2006
Posts: 199
Thanks: 8
Thanked 15 Times in 7 Posts
Wink Restore

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
mv /var/www /var/www.old
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
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.
mysql -u root -p
to log in and then
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.

Last edited by Morons; 27th July 2007 at 15:56.
Reply With Quote


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Backup script alex916 Installation/Configuration 5 6th June 2009 11:44
Setting up a backup mail server setup with two installations of ISPConfig zitch Tips/Tricks/Mods 7 30th December 2006 11:07
ISPConfig Backup problem gzero General 5 27th November 2006 10:48
backup script for mysql server pontifex Server Operation 2 27th June 2006 18:35
Incremental Backup chrno Installation/Configuration 2 17th May 2006 13:10

All times are GMT +2. The time now is 18:57.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.