Elxis CMS Forum

Support => FAQs => Topic started by: datahell on May 20, 2007, 14:46:08

Title: Full Elxis backup and restore
Post by: datahell on May 20, 2007, 14:46:08
This guide will show you show you can easily backup/restore an Elxis site. This guide is for server administrators and requires that you have a root account on the server. Notice: Shell scripts using  cron/jobs are also available (contact GO UP Inc for this) if you wish to create a demo site that will be refreshed automatically.

BACKUP
--> Database
Nothing special. Login to PHPmyAdmin and take a full backup. Check these options:
Add drop table
use backticks (`)
add auto increment

export as .sql file
Ok, you now have the database backup.

--> Files
Let's say the absolute path to our Elxis site is:
/home/user/public_html

Login into shell. Go to the Elxis root directory:

cd /home/user/public_html

tar everything:
tar -cf /home/user/sitebackup.tar .

Finish. Our files backup is at /home/user/sitebackup.tar


RESTORE
Take the sql file (ix sqlbackup.sql) previously created and place it inside /home/user directory.

We will create a small shell script (elxisrestore.sh) and then we will execute it at once.
To create it simple touch it:
cd /home/user
touch elxisrestore.sh

Then open it to edit it.
nano -w elxisrestore.sh

Add inside it the following code:

Code: (shell) [Select]
#!/bin/bash
#
# elxisrestore.sh v1.0 by Ioannis Sannos (Elxis Team)
#

# Parameters
elxisrootdir="/home/user/public_html"
tarfile="sitebackup.tar"
sqlfile="sqlbackup.sql"
startdir="/home/user"

# Database connection information
dbname="my_database_name"
dbhost="localhost"
dbuser="database_user"
dbpw="database_password"

# Remove old website files
rm -rf $elxisrootdir/*

# UnTAR Elxis files
cd $elxisrootdir
tar xf $startdir/$tarfile

cd $startdir
echo "use $dbname; set names utf8; source $sqlfile;" | mysql --password=$dbpw --user=$dbuser --host=$dbhost

Notice the "set names utf8;" command that we added after database selection.

Save this file as elxisrestore.sh
To get out of the editor press Ctrl+X. And then y (yes)

Go to /home/user directory:
cd /home/user

Change permissions to 777to the shell script  inorder to be executable:
chmod 777 elxisrestore.sh

finally execute it:

. elxisrestore.sh

That will restore both your files and database.

Hope you liked it!
Title: Re: Full Elxis backup and restore
Post by: Farhad Sakhaei on September 20, 2007, 12:27:32
hi john , i want to use Shell scripts using  cron/jobs to create a demo site , what do i to do?
Title: Re: Full Elxis backup and restore
Post by: datahell on September 20, 2007, 13:00:36
What exactly do you want to do? Create a demo site? Automatic backup? Something else? Better contact me via e-mail.
Title: Re: Full Elxis backup and restore
Post by: Farhad Sakhaei on September 20, 2007, 13:14:59
i sent you a pm
Title: Re: Full Elxis backup and restore
Post by: ahmet on December 13, 2011, 11:21:12
what happens if we dont have access to  shell ???
cant we restore the site from ftp and php my admin?
if theres can you tell me..
thanks..
Title: Re: Full Elxis backup and restore
Post by: webgift on December 13, 2011, 11:46:44
You can do by using for example cPanel website control panel. Here is several tools that you can easily backup/restore your elxis website.
Title: Re: Full Elxis backup and restore
Post by: datahell on December 13, 2011, 18:32:43
Note
The upcoming Elxis new generation (4.x Nautilus) has an integrated system to backup both database and files!
Title: Re: Full Elxis backup and restore
Post by: webgift on December 13, 2011, 19:53:51
Note
The upcoming Elxis new generation (4.x Nautilus) has an integrated system to backup both database and files!
Exactly! ;)
Title: Re: Full Elxis backup and restore
Post by: ahmet on December 14, 2011, 10:54:17
when i do it from cpanel , is there anything that i have to be  carefull?
thankss..
Title: Re: Full Elxis backup and restore
Post by: rentasite on December 14, 2011, 13:40:13
when i do it from cpanel , is there anything that i have to be  carefull?

Backup all your files and your database (as .sql file type) also! And you're done!
Title: Re: Full Elxis backup and restore
Post by: webgift on December 14, 2011, 22:03:21
;)