<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	>

<channel>
	<title>@ramgad.com! &#187; backup</title>
	<atom:link href="http://www.ramgad.com/tag/backup/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ramgad.com</link>
	<description>Patience is bitter, but its fruit is sweet. (Aristotle)</description>
	<pubDate>Sat, 03 Jan 2009 06:38:31 +0000</pubDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Backup Of Joomla, Drupal, EE, Wordpress, etc.</title>
		<link>http://www.ramgad.com/2008/03/23/backup-of-joomla-drupal-ee-vbulletin-etc/</link>
		<comments>http://www.ramgad.com/2008/03/23/backup-of-joomla-drupal-ee-vbulletin-etc/#comments</comments>
		<pubDate>Sun, 23 Mar 2008 21:56:43 +0000</pubDate>
		<dc:creator>Jeannot Muller</dc:creator>
		
		<category><![CDATA[shell scripts]]></category>

		<category><![CDATA[software]]></category>

		<category><![CDATA[backup]]></category>

		<category><![CDATA[drupal]]></category>

		<category><![CDATA[eengine]]></category>

		<category><![CDATA[joomla]]></category>

		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.ramgad.com/?p=147</guid>
		<description><![CDATA[It doesn&#8217;t matter what you&#8217;re running as CMS, forum or blog. Most software solutions are based on an Apache2 Server and a mySQL database. But only a few people are aware of appropriate backup solutions.
I hope below script will help people, who are not yet familar with rootserver, and are used to reinstall their systems [...]]]></description>
			<content:encoded><![CDATA[<!-- sphereit start --><p>It doesn&#8217;t matter what you&#8217;re running as CMS, forum or blog. Most software solutions are based on an Apache2 Server and a mySQL database. But only a few people are aware of appropriate backup solutions.</p>
<p>I hope below script will help people, who are not yet familar with rootserver, and are used to reinstall their systems (guess why I do know this ). Below two scripts will help you on creating a backup for your mySQL database and creating a dump of your whole web presentation files.</p>
<p>Below script will do the necessary <strong>BACKUP</strong> for you:</p>
<pre class="syntax-highlight:sh">
#!/bin/bash
# BACKUP SCRIPT FOR ROOTSERVERS
#
# ASSUMPTIONS:
# data stored in a mysql database (dumping and taring DB)
# webfiles (taring all webfiles)
#
# save this script e.g. web_backup.sh
# don&#039;t forget to chmod 700 web_backup.sh
# execute script via ./web_backup.sh
#
#
# DO NOT STORE FILES IN WEB ROOT FOR SECURITY PURPOSES!
#
# THIS SCRIPT IS OPENSOURCE
#
# written by Jeannot Muller
#
# mailto:jeannot.muller@ramgad.com:
# http://www.ramgad.com
#
#
# Version 2.1 (23th March 2008)

# DATADECLARATION
HOSTNAME=localhost
DB_NAME=&#039;db_name&#039;
DB_USER=&#039;db_user&#039;
DB_PASSWORD=&#039;db_password&#039;
BACKUP_PATH_DB=&#039;xxx&#039;
BACKUP_PATH_WB=&#039;yyy&#039;
BACKUP_NAME_DB=&#039;database&#039;
BACKUP_NAME_WB=&#039;webroot&#039;
WEB_ROOT_PATH=&#039;/var/www/&#039;
FTP_DEST=&#039;backup999.onlinehome-server.info&#039;
FTP_USER=&#039;ftp_user&#039;
FTP_PWRD=&#039;ftp_pwrd&#039;
FTP_PATH_DB=&#039;/db_backup/&#039;
FTP_PATH_WB=&#039;/wb_backup/&#039;

# BUILDING TIMESTAMP FOR ALL FILES
TIME_STAMP=`date +%m-%d-%Y-%Hh%M`

# DATA CLEANSING
# (delete all files older than 20 days)
find $BACKUP_PATH_DB -name &quot;*.tar.gz&quot; -mtime +20 -exec rm -f {} \;
find $BACKUP_PATH_WB -name &quot;*.tar.gz&quot; -mtime +20 -exec rm -f {} \;

# EXECUTING DUMP FROM MYSQL
cd $BACKUP_PATH_DB
mysqldump --opt -c -e -Q -h$HOSTNAME -u$DB_USER -p$DB_PASSWORD $DB_NAME &gt; $BACKUP_NAME_DB.sql

# COMPRESSING: DUMP AND ADDING TIMESTAMP
tar czpf $BACKUP_PATH_DB/$BACKUP_NAME_DB.$TIME_STAMP.tar.gz $BACKUP_NAME_DB.sql

# MOVING TO WEB_ROOT
cd $WEB_ROOT_PATH

# COMPRESSING ALL WEBROOT FILES (and copy latest version)
tar czpf $BACKUP_PATH_WB/$BACKUP_NAME_WB.$TIME_STAMP.tar.gz *
cp $BACKUP_PATH_WB/$BACKUP_NAME_WB.$TIME_STAMP.tar.gz $BACKUP_PATH_WB/$BACKUP_NAME_WB.tar.gz

# BACKUP TO EXTERNAL SERVER
ftp -n $FTP_DEST &lt;&lt;SCRIPT
quote USER $FTP_USER
quote PASS $FTP_PWRD
binary
put $BACKUP_PATH_DB/$BACKUP_NAME_DB.$TIME_STAMP.tar.gz $FTP_PATH_DB/$BACKUP_NAME_DB.$TIME_STAMP.tar.gz
put $BACKUP_PATH_WB/$BACKUP_NAME_WB.$TIME_STAMP.tar.gz $FTP_PATH_WB/$BACKUP_NAME_WB.$TIME_STAMP.tar.gz
quit
SCRIPT
exit 0
</pre>
<p>Below script will do the necessary <strong>RESTORE</strong> for you:</p>
<pre class="syntax-highlight:sh">
#!/bin/bash

# RESTORE SCRIPT FOR ROOTSERVERS
#
# ASSUMPTIONS:
# correct Datadeclaration
#
# save this script e.g. web_restore.sh
# don&#039;t forget to chmod 700 web_restore.sh
# execute script via ./web_restore.sh
#
#
# DO NOT STORE FILES IN WEB ROOT FOR SECURITY PURPOSES!
#
# THIS SCRIPT IS OPENSOURCE
#
# written by Jeannot Muller
#
# mailto:jeannot.muller@ramgad.com
# http://www.ramgad.com
#
#
# Version 2.1 (23th March 2008)

# DATADECLARATION
HOSTNAME=localhost
DB_NAME=&#039;db_name&#039;
DB_USER=&#039;db_user&#039;
DB_PASSWORD=&#039;db_password&#039;
BACKUP_PATH_DB=&#039;xxx&#039;
BACKUP_PATH_WB=&#039;yyy&#039;
BACKUP_NAME_DB=&#039;database&#039;
BACKUP_NAME_WB=&#039;webroot&#039;
WEB_ROOT_PATH=&#039;/var/www/&#039;

# CLEANSING WEBROOT
cd $WEB_ROOT_PATH
rm -R *

# COPYING BACKUP INTO ROOT
cp $BACKUP_PATH_WB/$BACKUP_NAME_WB.tar.gz $WEB_ROOT_PATH

# DECOMPRESSING FILES
tar xfvz $WEB_ROOT_PATH/$BACKUP_NAME_WB.tar.gz

# DELETING SOURCE IN ROOT
rm $WEB_ROOT_PATH/$BACKUP_NAME_WB.tar.gz

# RESTORE DATABASE
mysql -h$HOSTNAME -u$DB_USER -p$DB_PASSWORD $DB_NAME &lt; $BACKUP_PATH_DB/$BACKUP_NAME_DB.sql
</pre>
<!-- sphereit end --><span style="margin-bottom:40px; border-bottom:none;"><a class="iconsphere" title="Sphere: Related Content" onclick="return Sphere.Widget.search('http://www.ramgad.com/2008/03/23/backup-of-joomla-drupal-ee-vbulletin-etc/')" href="http://www.sphere.com/search?q=sphereit:http://www.ramgad.com/2008/03/23/backup-of-joomla-drupal-ee-vbulletin-etc/">Sphere: Related Content</a></span><br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.ramgad.com/2008/03/23/backup-of-joomla-drupal-ee-vbulletin-etc/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
