Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 2 > Tips/Tricks/Mods

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
View Poll Results: Is it useful for you a backup integrated on the ISPConfig?
Yes it is essential! 4 66.67%
Yes, but is better write our own shell script (more flexible) 2 33.33%
No, it is a stupid thing! 0 0%
Voters: 6. You may not vote on this poll

Thread Tools Display Modes
Old 5th September 2007, 15:48
vaio1 vaio1 is offline
Senior Member
Join Date: Jul 2007
Location: Italy
Posts: 664
Thanks: 77
Thanked 12 Times in 7 Posts
Talking [SHELL Script] - Backup WEB & DATABASES

Hi guys,

I have created a little script on the basis of the: http://www.howtoforge.com/forums/sho...61&postcount=2

This is a shell script that helps you to backup of all WEB SITES & DATABASES and compress them in various GZip file.

All gzip files are located in /home/backup/date[2007/09/05]/

The ISPCONFIG users prefix must be "web". So we have some databases like these:
  • web1_db1
  • web2_db1

and folders like these:
  • web1
  • web2

Now we must create a text file in the root directory and copy and paste this script. Remember to enable the file to the execution [rwxr-xr-x];

DATE=`date +%F`



mkdir -p $COPY_TO

echo "";
echo "************************************";
echo "       DATABASES BACKUP";
echo "************************************";
echo "";
for db in $(echo 'SHOW DATABASES;'|mysql -u$USER -p$PASSWORD -h$HOST|grep -v '^Database$'|grep "^web"); 
	  mysqldump \
              -u$USER -p$PASSWORD -h$HOST \
              -Q -c -C --add-drop-table --add-locks --quick --lock-tables \
              $db | gzip --best -c > $COPY_TO/$DBBACKUPNAME-$db.sql.gz;
		echo "Backup of" $db;

echo "";
echo "************************************";
echo "       WEB BACKUP";
echo "************************************";
echo "";

echo "Wait a moment please...";
for x in $(find $COPY_FROM -maxdepth 1 -name "web*" -type d -print0 | xargs -0)
  tar -cpvzf $COPY_TO/$WEBBACKUPNAME-$(basename $x).tar.gz $x &> /dev/null
echo "Done!";
[root@myserver1 ~]# ./make-backup


Backup of web11_db1
Backup of web13_db1
Backup of web13_db2
Backup of web13_db3
Backup of web13_db4
Backup of web14_db1
Backup of web14_db2
Backup of web16_db1
Backup of web18_db1
Backup of web7_db1
Backup of web7_db2
Backup of web9_db1


Wait a moment please...
[root@myserver1 ~]#

Any improve of this script is appreciated.

Last edited by vaio1; 5th September 2007 at 16:02.
Reply With Quote
The Following 4 Users Say Thank You to vaio1 For This Useful Post:
falko (6th September 2007), ras.su (23rd November 2008), torusturtle (19th September 2007), xarface (27th February 2008)
Sponsored Links


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
Web backup problem lano General 6 7th August 2009 18:24
Backup of Client Webspaces and Databases JohnSmith Feature Requests 5 2nd July 2007 09:53
Problems with the virtual email system with postfix, courier,mysql Greg Parker HOWTO-Related Questions 3 3rd January 2007 18:59
get thousands of "Mailsize" mails from own server torusturtle Installation/Configuration 20 24th December 2006 15:51
Total backup of files and databases nvn Installation/Configuration 1 12th May 2006 12:26

All times are GMT +2. The time now is 08:40.

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