• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Backup Skript

H

Herby

Guest
Hi,

I try to build a backupskript, to have a 2nd machine witch same data as server that I can switch to backupserver if something crashes.

What else should be reverse copied (what could change often ie includes customer details or server settings)

/home/httpd/vhosts/
/var/qmail/
/var/log/
/var/drweb/
/var/named/
/etc/httpd/conf/
/usr/local/psa/etc/
/usr/local/psa/var/
/usr/local/psa/admin/conf/httpsd.conf

+all existing databases

Anything missing?

br,
herby
 
I generally do the following directories:
/etc
/home
/usr/local/psa
/var

I actually just wrote a tutorial for using rsync over ssh on a new site I'm developing here:
www.unix-serve.com
It doesn't go into which directories you should backup, as that is unique to each server, but it should give you an idea how to do it pretty painlessly.

Edit: I forgot to mention MySQL. Although I do backup the raw databases under /var/lib/mysql, I do not use these for restoration. You should use mysqldump or mysqlhotcopy for doing MySQL backups, as they lock the db's during backup to avoid corruption. I prefer mysqldump, because it is fast and simple. To backup all DB's just do something like:
mysqldump -lv -uadmin -p`cat /etc/psa/.psa.shadow -A > mysqldump.sql
 
I am also transfering the files via rsync and ssh. The databases are dumped with:

mysqldump -qQ -u user -ppass --opt --all-databases > db.sql

But at restore I am running into a problem::
mysql -u user -ppass < db.sql
ERROR 1064 at line 11: You have an error in your SQL syntax near '-1062505950' at line 1

Line 11:
CREATE DATABASE /*!32312 IF NOT EXISTS*/ Mambo-1062505950;

I think the problem could be solved if there would be a way to quote the db-name also but I couldn't find an option for that.

Any hints?
br,
herby
 
your problem is in the database name...
In database restore it can't process the "-" sign. Try renaming the database and it will work.
 
lol i know this.

Renaming databases created by default in adminpanel by any customers isnt a solution.
 
Back
Top