Help - Search - Members - Calendar
Full Version: HOW-TO Use SysBK to Backup Your Plesk 6/7 Server
The Planet Forums > Control Panels > Plesk > Plesk HOWTOs
omegatng
I was going to write a custom backup script for Plesk 6/7, but I discovered that I could use the custom module of sysbk from rfxnetworks to do the same job, and alot easier!

You might ask why not just use the PSA backup utilities. Well, if you're using V7 of PSA right now, those won't work for you! And, even with 6, the PSA backup utilities are slow and just not that effective as a regular backup solution.

So, this HOW-TO will help you install sysbk and configure it for plesk.

STEP 1 - Download and Install SysBK

SSH into your server as root and change to your downloads folder, or wherever you download source / installer files:

CODE
cd /root/downloads/

wget [url]http://rfxnetworks.com/downloads/sysbk-current.tar.gz[/url]

cd sysbk-1.0

./install.sh


STEP 2 - Configure SysBK

CODE
cd /usr/local/sysbk

pico -w conf.sysbk


Make the following modifications:

Change MAX_LOAD to 5 (if you want, this is optional, see note #1)
Change HTTP_BK to 1
Change BIND_BK to 1
Change MYSQL_BK to 1
Change MYSQL_ROOTPW to your MySQL root password to your admin password for Plesk.
Change CUSTOM_BK to 1

Edit the /usr/local/sysbk/mod/custom.dirs and put the following directories in it:

CODE
/usr/local/psa

/home/httpd

/var/lib/qmail

/var/named

/etc


If you want to backup other folders, just add their full path.

Save and exit.

Unless you changed the backup folder, make sure /home/backups exists. I just add the user and set a password to it. You can make the directory by executing:

You should now be able to run sysbk, by executing:

CODE
/usr/local/sysbk/sysbk -s


If you are asked continously for your MySQL password during the MySQL backup stage, please check your password in /usr/local/sysbk/sysbk.conf

Note 1 - I use 5, but my load really never gets that high. If you want to use something lower or higher its fine. R-fx's default is 2, but if you have a load of 2 continously your backup may not run! icon_smile.gif

This is my first HOW-TO in EV1's forums, so if there are any corrections that need to be made please let me know!
mirage
Hi and thanks for the how to. Gonna give this a try and see if it runs faster than the backup script from the Hawk which is an excellent solution and i have been using it on our plesk 6 servers.

Quick question:
Shouldn't the CUSTOM_BK be enabled before the script can use the custom.dir?
omegatng
Absolutely right! CUSTOM_BK has to be set to 1. I updated the HOW-TO. Thanks! icon_smile.gif
Veloce
I had to add a user "root" with "ALL PRIVELDGES" for MYSQL to be able to back users db's.

"admin" was the default on my RedHat 9 Plesk 6 box
thelocust
I have patched sysbk 1.0 to added support for PostgreSQL support as well as the ability to specify the user for your MySQL dumps. (noted in the post above me).

Get the patch and/or the complete tarball here:
http://thelocust.org/projects/misc/

Let me know if you have any problems...

ben@thelocust.org
JLChafardet
i am trying what do you sayd here!

and got:

[root@hve01 sysbk]# /usr/local/sysbk/sysbk -s
/usr/local/sysbk/sysbk: line 81: t: command not found
/usr/local/sysbk/sysbk: line 82: q: command not found
/usr/local/sysbk/sysbk: line 84: x: command not found
/usr/local/sysbk/sysbk: line 85: r: command not found
/usr/local/sysbk/sysbk: line 86: t: command not found
/usr/local/sysbk/sysbk: line 87: q: command not found
/usr/local/sysbk/sysbk: line 109: x: command not found
17:20:21 up 1:09, 1 user, load average: 0.00, 0.00, 0.00
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/0 200.84.203.168 4:11pm 0.00s 0.88s 0.01s /bin/sh /usr/local/sysbk/sysbk -s
SysBK 1.0 [sysbk@r-fx.net]
Performing sanity checks: [ COMPLETED ]
Checking load average: [ COMPLETED ]
Checking free disk space: [ COMPLETED ]
Performing Custom backup
Archiving /usr/local/psa: [ COMPLETED ]
Archiving /var/lib/qmail: [ COMPLETED ]
Archiving /var/named: [ COMPLETED ]
Archiving /etc: [ COMPLETED ]
Archiving /root: [ COMPLETED ]
Archiving /home: [ COMPLETED ]
Performing DNS backup
Stage 1 DNS backup: [ COMPLETED ]
Stage 2 DNS backup: [ COMPLETED ]
Performing Apache backup: [ COMPLETED ]
Performing MySQL backup
Stage 1 MySQL backup: [ COMPLETED ]
Stage 2 MySQL backup:/usr/bin/myisamchk: MyISAM file /var/lib/mysql/horde/horde_prefs.MYI
/usr/bin/myisamchk: warning: 1 clients is using or hasn't closed the table properly
[ COMPLETED ]
Stage 3 MySQL backup:
Dumping database herman_herman: [ COMPLETED ]
Dumping database horde: [ COMPLETED ]
Dumping database hvecontacto: [ COMPLETED ]
Dumping database hvedrago: [ COMPLETED ]
Dumping database hvegeneral: [ COMPLETED ]
Dumping database hvesoporte: [ COMPLETED ]
Dumping database knowledgebuilder: [ COMPLETED ]
Dumping database ladi_llados: [ COMPLETED ]
Dumping database mysql: [ COMPLETED ]
Dumping database phpmyadmin: [ COMPLETED ]
Dumping database psa: [ COMPLETED ]
Performing cleanup operations: [ COMPLETED ]
[root@hve01 sysbk]#


this is ok???? should i edit the lines of the wierd errors?

i did remove the errors! now how do i do to have all the backup in 1 single file? for download?
thelocust
QUOTE
Originally posted by JLChafardet
i am trying what do you sayd here!

and got:

[root@hve01 sysbk]# /usr/local/sysbk/sysbk -s
/usr/local/sysbk/sysbk: line 81: t: command not found
/usr/local/sysbk/sysbk: line 82: q: command not found
/usr/local/sysbk/sysbk: line 84: x: command not found
/usr/local/sysbk/sysbk: line 85: r: command not found
/usr/local/sysbk/sysbk: line 86: t: command not found
/usr/local/sysbk/sysbk: line 87: q: command not found
/usr/local/sysbk/sysbk: line 109: x: command not found

this is ok???? should i edit the lines of the wierd errors?

i did remove the errors! now how do i do to have all the backup in 1 single file? for download?


I did not write sysbk, only extended it as noted above. I do not think your errors are because of my changes.
JLChafardet
This time all went beutifull icon_biggrin.gif

[root@hve01 admin]# /usr/local/sysbk/sysbk -s
/usr/local/sysbk/sysbk: line 103: x: command not found
17:40:02 up 1:29, 1 user, load average: 0.16, 0.07, 0.12
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/0 200.84.203.168 4:11pm 0.00s 1.03s 0.00s /bin/sh /usr/local/sysbk/sysbk -s
SysBK 1.0 [sysbk@r-fx.net]
Performing sanity checks: [ COMPLETED ]
Checking load average: [ COMPLETED ]
Checking free disk space: [ COMPLETED ]
Performing Custom backup
Archiving /usr/local/psa: [ COMPLETED ]
Archiving /var/lib/qmail: [ COMPLETED ]
Archiving /var/named: [ COMPLETED ]
Archiving /etc: [ COMPLETED ]
Archiving /root: [ COMPLETED ]
Archiving /home: [ COMPLETED ]
Performing DNS backup
Stage 1 DNS backup: [ COMPLETED ]
Stage 2 DNS backup: [ COMPLETED ]
Performing Apache backup: [ COMPLETED ]
Performing MySQL backup
Stage 1 MySQL backup: [ COMPLETED ]
Stage 2 MySQL backup: [ COMPLETED ]
Stage 3 MySQL backup:
Dumping database herman_herman: [ COMPLETED ]
Dumping database horde: [ COMPLETED ]
Dumping database hvecontacto: [ COMPLETED ]
Dumping database hvedrago: [ COMPLETED ]
Dumping database hvegeneral: [ COMPLETED ]
Dumping database hvesoporte: [ COMPLETED ]
Dumping database knowledgebuilder: [ COMPLETED ]
Dumping database ladi_llados: [ COMPLETED ]
Dumping database mysql: [ COMPLETED ]
Dumping database phpmyadmin: [ COMPLETED ]
Dumping database psa: [ COMPLETED ]
Performing cleanup operations: [ COMPLETED ]
[root@hve01 admin]#

perfect perfect perfect!!!! u r the man icon_wink.gif

now does this mean, that i can do a upgrade to plesk 7.0.1 and if it doesnt work i can restore back to this last state? or do i have to backup another folders?

best regards and thanks in advance for all this whoto!

JLChafardet
JLChafardet
removed by me! thanks to NightHawk, it seems that my english wasnt letting me explain me, wasnt ALLOWING me to understand icon_biggrin.gif

again thanks nighthawk, and sorry for my lameness

JLChafardet
JLChafardet
QUOTE
[root@hve01 sysbk]# /usr/local/sysbk/sysbk -s
/usr/local/sysbk/sysbk: line 81: t: command not found
/usr/local/sysbk/sysbk: line 82: q: command not found
/usr/local/sysbk/sysbk: line 84: x: command not found
/usr/local/sysbk/sysbk: line 85: r: command not found
/usr/local/sysbk/sysbk: line 86: t: command not found
/usr/local/sysbk/sysbk: line 87: q: command not found
/usr/local/sysbk/sysbk: line 109: x: command not found
Originally posted by thelocust
I did not write sysbk, only extended it as noted above.  I do not think your errors are because of my changes.


the errors was maded by me! maybe i did typed something when editing the conf

look now i was trying to recover 1 of the tars (the /home one) and got a lot of errors, it didnt allowed me to extract, the errors caused an abort!

any idea?
omegatng
What was the error message in the untar operation?
JLChafardet
i dont remember the error that gave me the untar, but i managed to extract the files with midnight commander.

thanks in advance and best regards,

__________________
JLChafardet
PSA 7.0.1 - RHE ES 3

who can explain why Front Page
and Fisher Price share the same
initials "FP" ???
DennisCitus
Anybody using this without problems?
thelocust
Yes, I am. It works just fine for my needs! I have it run every week, and so far, so good.
Gromit
Hi, has anyone yet had to use a backup created with sysbk to restore an entire server? I'm guessing that at the very least you need to start with the same version of Plesk, but then what do you do? Do you simply untar everything into its proper place and pipe the entire mysql backup back in?

Thanks,
-G
dennis00
QUOTE
Originally posted by Gromit
Hi, has anyone yet had to use a backup created with sysbk to restore an entire server?  I'm guessing that at the very least you need to start with the same version of Plesk, but then what do you do?  Do you simply untar everything into its proper place and pipe the entire mysql backup back in?

Thanks,
-G
Yes, I did. And experienced no problems.
MattKD
Hi Guys,

Can anyone expand on the commands used to restore the backup files and especially the mySQL databases, users etc...

A couple of people mentioned that they fully restored a system using the backup files and I was just looking for an idea of the order to do this in, commands used if possible to restore Plesk users and all,

Thanks for any info! Matt
jeffprom
good tutorial omegatng. thanks.
one note is that it backs up to /home/backup and not /home/backups

I followed everything and it seems to run, create a directory, but never seems to backup any data. the directory /home/backup/11-30-04 is empty. and here is what runs:

[root@serv sysbk]# ./sysbk -s
SysBK version 1.2
Copyright © 1999-2004, R-fx Networks
Copyright © 2004, Ryan MacDonald
This program may be freely redistributed under the terms of the GNU GPL

Performing sanity checks: [ COMPLETED ]
Checking load average: [ COMPLETED ]
Checking free disk space: [ COMPLETED ]
Performing cleanup operations: [ COMPLETED ]
[root@serv sysbk]#

any ideas?
MattKD
Hey...

Did you:
Change CUSTOM_BK to 1

And add the directories to the /usr/local/sysbk/mod/custom.dirs file?

Thanks, Matt
jeffprom
yes I did. I've been turning things on and off (0, 1) and it seems to make no difference. it just does the same thing and doesn't backup anything. very odd.
JLChafardet
as a matter of fact it happens the same to me now, i upgraded to sysbk 1.2 and now nothing but that thing.

[root@hve01 backup]# sysbk -s
SysBK version 1.2
Copyright © 1999-2004, R-fx Networks
Copyright © 2004, Ryan MacDonald
This program may be freely redistributed under the terms of the GNU GPL

Performing sanity checks: [ COMPLETED ]
Checking load average: [ COMPLETED ]
Checking free disk space: [ COMPLETED ]
Performing cleanup operations: [ COMPLETED ]
[root@hve01 backup]#


any ideas?
JLChafardet
It seems that it has been fixed by r-fx, looks like it was an internal error.

it works great now.

regards,
admin123
Look below and my sql is failing to shut down. any clues? Now I can't access my website. Thanks.

Performing sanity checks: [ COMPLETED ]
Checking load average: [ COMPLETED ]
Checking free disk space: [ COMPLETED ]
Performing Custom backup
Archiving /usr/local/psa: [ COMPLETED ]
Archiving /home/httpd: [ COMPLETED ]
Archiving /var/lib/qmail: [ COMPLETED ]
Archiving /var/names: [ COMPLETED ]
Archiving /etc: [ COMPLETED ]
Performing DNS backup
Stage 1 DNS backup: [ COMPLETED ]
Stage 2 DNS backup: [ COMPLETED ]
Performing Apache backup: [ COMPLETED ]
Performing MySQL backup
Stage 1 MySQL backup: [ FAILED ]
MySQL could not be shutdown, aborting...
Performing cleanup operations: [ COMPLETED ]
admin123
for some reason seems that i have to manually stop mysql, do the backup, and then start mysql again and all is fine...don't know why though icon_smile.gif
dbembibre
Installed and tested, work fine
DoobyWho
Is this even secure? I mean, storing your root password in the file...
DoobyWho
also - no matter what I do - i have the same problem. It won't stop mysql. If i stop mysql and then run it, it still fails the mysql backup. help!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.