<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[FrontAccounting forum — Need to be able to make a site copy]]></title>
		<link>https://frontaccounting.com/punbb/viewtopic.php?id=3943</link>
		<atom:link href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=3943&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Need to be able to make a site copy.]]></description>
		<lastBuildDate>Tue, 12 Mar 2013 22:44:41 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Need to be able to make a site copy]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=16012#p16012</link>
			<description><![CDATA[<p>To reply to my own post...</p><p>It needed a restart of Apache to enable the copy site to work without the error.</p><p>For reference here&#039;s my script which makes a copy of a site - I&#039;ll try to find somewhere on the wiki where it might be useful.</p><p>NB - The server runs Apache ITK so all files are owned by a single user.</p><div class="codebox"><pre><code>#!/bin/bash

# copy_accounts_to_accounts2

# ----------------------------------------------------------------------------------
# This will take a copy of the live Open Atrium site and copy it to a training copy.
# ----------------------------------------------------------------------------------

# -------------------------------------------------------------------------------------------------
# Logging setup
# -------------------------------------------------------------------------------------------------

# These lines have been copied from http://stackoverflow.com/questions/3173131/redirect-copy-of-stdout-to-log-file-from-within-bash-script-itself
# and will send the script output to a log file.
##mkdir -p /var/backups/sbin
##mkdir -p ~/logs/pullpush
##DATE_TIME=`date +%Y%m%d-%H%M%S`
##logfile=~/logs/pullpush/pulldevfrombeta_${DATE_TIME}.log
##mkfifo ${logfile}.pipe
##tee &lt; ${logfile}.pipe $logfile &amp;
##exec &amp;&gt; ${logfile}.pipe
##rm ${logfile}.pipe

DATE_TIME=`date +%Y%m%d-%H%M%S`

# -------------------------------------------------------------------------------------------------
echo
echo `date`
echo &quot;Backup primary site...&quot;
# -------------------------------------------------------------------------------------------------

# Here we will create backups which are datetime stamped to be able to go back to a previous 
# version if necessary.
mkdir -p /home/frontacc/backups
mysqldump frontacc &gt; /home/frontacc/backups/${DATE_TIME}_frontacc.sql
tar --create --file=/home/frontacc/backups/${DATE_TIME}_frontacc.tar /home/frontacc/public_html

# Here we will make a backup to a standard location so that it is backed up by backup scripts.
mysqldump frontacc &gt; /var/backups/frontacc.sql
tar --create --file=/var/backups/frontacc.tar /home/frontacc/public_html

# -------------------------------------------------------------------------------------------------
echo
echo `date`
echo &quot;Load the backup into the site...&quot;
# -------------------------------------------------------------------------------------------------
mysqladmin --force drop frontacc2
mysqladmin create frontacc2

mysql frontacc2 &lt; /var/backups/frontacc.sql

rm -r /home/frontacc2/public_html/*
tar -x --file=/var/backups/frontacc.tar --directory=/home/frontacc2/public_html --strip-components=3 

# We need to change ownership to openatriumcopy for the files just unzipped and need to change permissions
# on the files/ directory.
chown -R frontacc2:frontacc2 /home/frontacc2/public_html

# -------------------------------------------------------------------------------------------------
echo
echo `date`
echo &quot;Set up the settings.php file...&quot;
# -------------------------------------------------------------------------------------------------
sed -i &#039;s/Freeway Projects Limited/Freeway Projects Limited2/g&#039; /home/frontacc2/public_html/config_db.php
sed -i &#039;s/frontacc/frontacc2/g&#039; /home/frontacc2/public_html/config_db.php
sed -i &#039;s/firstsitepasswd/secondsitepassword/g&#039; /home/frontacc2/public_html/config_db.php




# -------------------------------------------------------------------------------------------------
echo
echo `date`
echo &quot;Setting up the copy site with a different appearance from the live site...&quot;
# -------------------------------------------------------------------------------------------------
## Todo


# -------------------------------------------------------------------------------------------------
echo
echo `date`
echo &quot;A restart of Apache is needed for the copy site to work...&quot;
# -------------------------------------------------------------------------------------------------
apache2ctl restart


# -------------------------------------------------------------------------------------------------
echo
echo `date`
echo &quot;Finished&quot;
# -------------------------------------------------------------------------------------------------</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (bailey86)]]></author>
			<pubDate>Tue, 12 Mar 2013 22:44:41 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=16012#p16012</guid>
		</item>
		<item>
			<title><![CDATA[Need to be able to make a site copy]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=16011#p16011</link>
			<description><![CDATA[<p>Hi,</p><p>I&#039;d like to make a complete copy of a FA install - I&#039;ve copied the database and the files - changed the database settings in config_db.php but I&#039;m getting the error:</p><p> PHP Fatal error:&nbsp; Class &#039;application&#039; not found in /home/frontacc2/public_html/applications/customers.php on line 13</p><p>Any pointers gratefully received.</p>]]></description>
			<author><![CDATA[null@example.com (bailey86)]]></author>
			<pubDate>Tue, 12 Mar 2013 22:18:28 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=16011#p16011</guid>
		</item>
	</channel>
</rss>
