Help - Search - Members - Calendar
Full Version: How to use the plesk backup utilities for running regulary scheduled backups
The Planet Forums > Control Panels > Plesk > Plesk HOWTOs
Pages: 1, 2
nacarls
ok...i feel stupid icon_smile.gif. it transfers everything from within the scripts folder...lol. So as long as the script is in the folder where your dump files are...you should be set...just ignore the interactive warn ing.
juan
Thank you, it's now working, just needed this "#!/bin/bash" line at the begining.

Rock on! icon_wink.gif
Cranky
Remember that FTP transfers are plain-text .... unencrypted ... it would be better to use rsync or something similar to transfer via a secure connection.
NightHawk
QUOTE
Originally posted by Cranky
Remember that FTP transfers are plain-text .... unencrypted ... it would be better to use rsync or something similar to transfer via a secure connection.


or simply run the plesk backups over ssh via the pull method instead of a push...(as documented in the release notes for the backup utilities).

for example:

Just replace "" with your real ip# ..(you will also need to setup a ssh key to connect with....but that's another post...

[PHP]
####################################
###remote backup script for plesk###
###put this script in cron.daily ###
### on the backup server ###
####################################
#!/bin/bash/bin/rm -Rf /dump3
/bin/mv /dump2 /dump3
/bin/mv /dump1 /dump2
/bin/mkdir /dump1
cd /dump1
ssh -C -x root@ /usr/local/psa/bin/psadump -F -f - --nostop --tar-ignore-failed-read | gzip | split -b 1000m - dump.
####################################
##########done######################
####################################
[/PHP]
juan
My remote server is a Windows box, I would have to install and configure some ssh server software there isn't it?
exo
Just to note that Plesk 6.0 BU are out since a couple of days ago. Of course, I mean final release, no the beta ones.
NightHawk
QUOTE
Originally posted by juan
My remote server is a Windows box, I would have to install and  configure some ssh server software there isn't it?


eww...sorry to hear that....

you are probably best off with ftp (maybe ftps...not sure how to setup your winblows box to handle that though).
NightHawk
QUOTE
Originally posted by exo
Just to note that Plesk 6.0 BU are out since a couple of days ago. Of course, I mean final release, no the beta ones.


Yep ... Yep...posted all over the place.....

and they work just fine....have tested them on a few boxes...

The work with all the examples I have posted in this thread...
md3v
I am running this script:

#####
###local backups
###put this script in cron.daily
#####
#!/bin/bash
/bin/rm -Rf /dump3
/bin/mv /dump2 /dump3
/bin/mv /dump1 /dump2
/bin/mkdir /dump1
cd /dump1
/usr/local/psa/bin/psadump -F -f - --nostop --tar-ignore-failed-read | split -b 1000m - dump.
####################################
###end of include###################
####################################

On my Plesk 6.01 box, I have a second hard drive (/home2) which I'd like the dump/s to end up on.

Does the above script do that?
NightHawk
QUOTE
Originally posted by md3v
I am running this script:

#####
###local backups
###put this script in cron.daily
#####
#!/bin/bash
/bin/rm -Rf /dump3
/bin/mv /dump2 /dump3
/bin/mv /dump1 /dump2
/bin/mkdir /dump1
cd /dump1
/usr/local/psa/bin/psadump -F -f - --nostop --tar-ignore-failed-read | split -b 1000m - dump.
####################################
###end of include###################
####################################

On my Plesk 6.01 box, I have a second hard drive (/home2) which I'd like the dump/s to end up on.  

Does the above script do that?


no...but if you use this one.. (which was in the first post of this thread) it does:

[PHP]
#####
###local backups on a box with 2 HD's
###put this script in cron.dail
###must have 2nd HD mounted as /home2 for this to work
#####
#!/bin/bash
/bin/rm -Rf /home2/dump3
/bin/mv /home2/dump2 /home2/dump3
/bin/mv /home2/dump1 /home2/dump2
/bin/mkdir /home2/dump1
cd /home2/dump1
/usr/local/psa/bin/psadump -F -f - --nostop --tar-ignore-failed-read | split -b 1000m - dump.

####################################
###end of include###################
####################################
[/PHP]

As you can see the only real differnece is that paths....
md3v
Thanks for the clarification on that, I moved the root dump* to /home2 and manually ran the script. It seems to be working right.
NightHawk
QUOTE
Originally posted by md3v
Thanks for the clarification on that, I moved the root dump* to /home2 and manually ran the script. It seems to be working right.


that should do it....glad you got it all sorted...enjoy:cool:
juan
Here's how I finally got it to work, it exactly do what I want to do. I run it from in my crontabs every sunday at nidnight, it delete previous week backups from the box itself and from the remote server where I send backup file. Then it perform a new backup and send it to my home server.

I put both script in the the "/usr/local/psa/bin/" direcotry, first one I named psabackupbatch and second one ftpbackup.

First I call this script (psabackupbatch) from my crontabs, it removes last week backup from the server, build a new one and then it call the ftpbackup script to upload the .archive file to my home serv-u ftp server.
CODE
rm -fr /usr/local/psabackup

mkdir 775 /usr/local/psabackup

/usr/local/psa/bin/psadump -F -f /usr/local/psabackup

/usr/local/psa/bin/ftpbackup


This is the second script (ftpbackup), it is called from the previous script. Tt's purpose if to send the backup file to my home ftp. Just ensure that the home directory of this user is where you want to backups to be sent, it will first delete the last week backup and then upoad the current one.
CODE
#!/bin/bash

cd /usr/local/psabackup

ftp -n ftp.server.com <<!EOF!

user username password

mdelete *.archive

binary

prompt

mput *

quit
md3v
Hi,

Slightly off topic, but would it not be more secure to use SCP in the above script rather than FTP?

m.
juan
QUOTE
Originally posted by md3v
Hi,

Slightly off topic, but would it not be more secure to use SCP in the above script rather than FTP?

m.


Sure yes, just didn't found a way to have it 100% automated yet using SCP or something with my actual knowledge. At least now the job is done but I would be interested to find a better way that'S for sure.
Cranky
When running BU6 on two RH9 servers it only dumps the crontab for the users ... nothing more ... then stops.

QUOTE
===============================================================================
 
Check postgres database existing ... found postgres database(s).
dumping crontab of root
dumping crontab of mailman
Database test backup is skipped: error during checking database existing.
...
...
...
dumping crontab of fjdhd1
dumping crontab of fdjkfdj2
 
===============================================================================


Any ideas?
NightHawk
QUOTE
Originally posted by Cranky
When running BU6 on two RH9 servers it only dumps the crontab for the users ... nothing more ... then stops.



Any ideas?


What command line are you using to run them??
Cranky
Hi,

/usr/local/psa/bin/psadump1 --nostop --force -F -f - | split -b 1000m - /home/backup/zeus.dump.

Works fine on a Plesk 6 RH7.3 server, but not on 2 RH9 servers.
NightHawk
QUOTE
Originally posted by Cranky
Hi,

/usr/local/psa/bin/psadump1 --nostop --force -F -f - | split -b 1000m - /home/backup/zeus.dump.

Works fine on a Plesk 6 RH7.3 server, but not on 2 RH9 servers.


Works fine on my plesk6 rh9 box: (it did give me back a prompt after the crontabs...but it did continue on to dump the domains, etc.)

[root@www psadumps]# /usr/local/psa/bin/psadump --nostop --force -F -f - | split -b 1000m - dump.

===============================================================================

Postgres is not configured (unable to define pg admin login and password).
dumping crontab of root
dumping crontab of mailman
dumping crontab of nine-one
dumping crontab of speedy
[Sat Oct 25 12:53:23 2003] dumping directory '/home/httpd/vhosts/.skel' ... done
[Sat Oct 25 12:53:23 2003] dumping directory '/home/httpd/vhosts/default' ... done
[Sat Oct 25 12:56:40 2003] dumping directory '/usr/local/psa/admin/htdocs//skins/Standard_1' ... done
[Sat Oct 25 12:56:41 2003] dumping directory '/usr/local/psa/admin/htdocs//skins/Standard_2' ... done
[Sat Oct 25 12:56:41 2003] dumping directory '/usr/local/psa/admin/htdocs//skins/Standard_3' ... done
[Sat Oct 25 12:56:41 2003] dumping directory '/usr/local/psa/admin/htdocs//skins/Standard_4' ... done
[Sat Oct 25 12:56:41 2003] dumping directory '/usr/local/psa/admin/htdocs//skins/Standard_5' ... done
[Sat Oct 25 12:56:41 2003] dumping directory '/usr/local/psa/admin/htdocs//skins/Standard_6' ... done
[Sat Oct 25 12:56:42 2003] dumping directory '/usr/local/psa/admin/htdocs//skins/Standard_7' ... done
[Sat Oct 25 12:56:42 2003] dumping mysql database test ... done
[Sat Oct 25 12:56:42 2003] dumping mysql database horde ... done
[Sat Oct 25 12:56:42 2003] dumping mysql database familyboard ... done
[Sat Oct 25 12:56:42 2003] turning domain "domain.com" off ... done
[Sat Oct 25 12:56:42 2003] dumping directory '/home/httpd/vhosts/domain.com' ... done
[Sat Oct 25 12:56:42 2003] turning domain "domain.comt" on ... done
[Sat Oct 25 13:00:12 2003] turning domain "domain.com" off ... pipe_util: domainmng: no crontab for domainuser
done


===============================================================================


I would suggest reinstalling your plesk6 backup utlities.
Cranky
Ohh .... so it does dump them, but not verbosely?

It drops back to a shell after crontab ... but doesn't show the dumping domain lines. I tried reinstalling BU6.
NightHawk
QUOTE
Originally posted by Cranky
Ohh .... so it does dump them, but not verbosely?

It drops back to a shell after crontab ... but doesn't show the dumping domain lines. I tried reinstalling BU6.


ok, sounds like a plan....good luck!
vara
I tried to do the following:
ssh -C -x root@ -F -f - --nostop --tar-ignore-failed-read | split -b 1000m - dump

I received this error (continuous).
/var/backup/: line 1: Sat: command not found
Disconnecting: Corrupted MAC on input.

Anyone have any clues.
Also when I do the above command it prompts for the password. If I run this in a cron job, can I get it to not prompt for password.
Thanks in advance:)

--------
vara
md3v
I am using:

#####
###local backups on a box with 2 HD's
###put this script in cron.dail
###must have 2nd HD mounted as /home2 for this to work
#####
#!/bin/bash
/bin/rm -Rf /home2/dump3
/bin/mv /home2/dump2 /home2/dump3
/bin/mv /home2/dump1 /home2/dump2
/bin/mkdir /home2/dump1
cd /home2/dump1
/usr/local/psa/bin/psadump -F -f - --nostop --tar-ignore-failed-read | split -b 1000m - dump.

####################################
###end of include###################
####################################

Would I restore this backup in the event of a primary disk failure? Will it retain the permissions on the file?
Cranky
QUOTE
Originally posted by NightHawk
ok, sounds like a plan....good luck!


I tried reinstalling again, and asking on Plesk forums, but still can't get it working. Any ideas of what I should/could try?

@md3v - "Would I restore this backup in the event of a primary disk failure? Will it retain the permissions on the file?"

Yes this would restore ALL Plesk data - webspace, email, configuration etc. It should also retain permissions, but I've heard reports it doesn't so I'll can't promise that.
NightHawk
QUOTE
Originally posted by vara
I tried to do the following:
ssh -C -x root@ -F -f - --nostop --tar-ignore-failed-read | split -b 1000m - dump

I received this error (continuous).
/var/backup/: line 1: Sat: command not found
Disconnecting: Corrupted MAC on input.

Anyone have any clues.
Also when I do the above command it prompts for the password. If I run this in a cron job, can I get it to not prompt for password.
Thanks in advance:)  

--------
vara


needs to be /usr/local/psa/bin/psadump ..it looks like instead you put your backup destination file...which is what caused your error.

As for having this work without passwords, check the forums for ssh keys.
md3v
I was asking how to reverse the below in order to restore:

#####
###local backups on a box with 2 HD's
###put this script in cron.dail
###must have 2nd HD mounted as /home2 for this to work
#####
#!/bin/bash
/bin/rm -Rf /home2/dump3
/bin/mv /home2/dump2 /home2/dump3
/bin/mv /home2/dump1 /home2/dump2
/bin/mkdir /home2/dump1
cd /home2/dump1
/usr/local/psa/bin/psadump -F -f - --nostop --tar-ignore-failed-read | split -b 1000m - dump.

####################################
###end of include###################
####################################
Cranky
Sorted my problem .. because I renamed psadump to psadump1 it failed. I renamed to psadump again and it works fine, strange.
NightHawk
QUOTE
Originally posted by md3v
I was asking how to reverse the below in order to restore:

#####  
###local backups on a box with 2 HD's  
###put this script in cron.dail  
###must have 2nd HD mounted as /home2 for this to work  
#####  
#!/bin/bash  
/bin/rm -Rf /home2/dump3  
/bin/mv /home2/dump2 /home2/dump3  
/bin/mv /home2/dump1 /home2/dump2  
/bin/mkdir /home2/dump1  
cd /home2/dump1  
/usr/local/psa/bin/psadump -F -f - --nostop --tar-ignore-failed-read | split -b 1000m - dump.  

####################################  
###end of include###################  
####################################


You might want to go back to the first page of this thread....where you will find:

###restore procedure

Check that post (it's the 2nd one I think)...it should answer all your questions.
md3v
Hi..

QUOTE
#####
###restore procedure
### for gzip backups
#####
cd /psadumps
cat dump.* | gzip -d | /usr/local/psa/bin/psarestore -m map_file -s shells_map_file -f -
vi map_file
vi shells_map_file
cat dump.* | gzip -d | /usr/local/psa/bin/psarestore -m map_file -s shells_map_file -f -
####################################
###end of include###################
####################################


Would I replace /psadumps with the latest dump, e.g. /home2/dump1 ?
NightHawk
QUOTE
Originally posted by md3v
Hi..



Would I replace /psadumps with the latest dump, e.g. /home2/dump1 ?


Yes, you would want to modify that to match the location of the files that you want to restore from.
MattKD
Hi Guys,

Does anyone know the option to exclude a certain domaindomains from the backup procedure?

Thanks in advance,

m@
cliftonarms
After following this thread I ran zzbackup.sh to see that all was working ok and all my domains had the following echoed message from the backup script.

[Wed Nov 19 15:40:21 2003] dumping directory '/home/httpd/vhosts/smeoutsource.com' ... done
[Wed Nov 19 15:40:21 2003] turning domain "smeoutsource.com" on ... pipe_util: domainmng: You (username ) are not allowed to use this program (crontab)
See crontab(1) for more information

From this message I can only assume that none of my domains have backed up. Any ideas of how to fix this would be gratefully accepted.

Regards
Andy
NightHawk
QUOTE
Originally posted by cliftonarms
After following this thread I ran zzbackup.sh to see that all was working ok and all my domains had the following echoed message from the backup script.

[Wed Nov 19 15:40:21 2003] dumping directory '/home/httpd/vhosts/smeoutsource.com' ... done
[Wed Nov 19 15:40:21 2003] turning domain "smeoutsource.com" on ... pipe_util: domainmng: You (username ) are not allowed to use this program (crontab)
See crontab(1) for more information

From this message I can only assume that none of my domains have backed up. Any ideas of how to fix this would be gratefully accepted.

Regards
Andy


Did you run that as root? From the looks of it you didn't. The plesk backup has to be run as the root user.
NightHawk
QUOTE
Originally posted by MattKD
Hi Guys,

Does anyone know the option to exclude a certain domaindomains from the backup procedure?

Thanks in advance,

m@


You would want to use these commands:
--clients-ids - file with clients ids list which must be dumped;
--clients-logins - file with clients logins list which must be dumped;
--domains-ids - file with domains ids list which must be dumped;
--domains-names - file with domains names list which must be dumped;


You can find all the options by running:
/usr/local/psa/bin/psadump -h
cliftonarms
QUOTE
Originally posted by NightHawk
Did you run that as root?  From the looks of it you didn't.  The plesk backup has to be run as the root user.


Yes it was run as root [root@svr01 cron.daily]#

checked /etc/cron.allow and it only has root in as well
NightHawk
QUOTE
Originally posted by cliftonarms
Yes it was run as root [root@svr01 cron.daily]#  

checked /etc/cron.allow and it only has root in as well


ahh..that may very well be your problem....suggest removing the /etc/cron.allow file and re-running the backup.
cliftonarms
QUOTE
Originally posted by NightHawk
ahh..that may very well be your problem....suggest removing the /etc/cron.allow file and re-running the backup.


Quite the opposite.. The zzbackup script will only work if I put the domain users in the cron.allow file. If its empty all user backups show an error.

Any ideas?
NightHawk
QUOTE
Originally posted by cliftonarms
Quite the opposite.. The zzbackup script will only work if I put the domain users in the cron.allow file. If its empty all user backups show an error.

Any ideas?


check your /etc/cron.deny ...do you have it set to only allow valid users from cron.allow ?

#####
The cron.allow and cron.deny files are lists, containing one user name per line.

You are allowed to use crontab if your login name appears in the file /etc/cron.allow. If cron.allow does not exist, the crontab command checks the /etc/cron.deny file to determine if you are denied the use of crontab. If neither file exists, you can use crontab only if you are root. If only cron.deny exists and is empty, then anyone is allowed to use crontab.

#####


the plesk backup utilities are setup to be run from inside the cp by each user...and therefore when you run a server wide one at the command line, it uses each user to run...
cliftonarms
That works now NightHawk. Thanks

I deleted cron.deny ( which was populated ) and cron.allow.

I thought having an empty cron.allow was a security risk ?
NightHawk
QUOTE
Originally posted by cliftonarms
That works now NightHawk. Thanks

I deleted cron.deny ( which was populated ) and cron.allow.

I thought having an empty cron.allow was a security risk ?


if cron.deny doesn't exist...then the cron.allow doesn't mean much..

it could be a security risk...if you have users that you don't want to setup crons...but since every user has to have cron access for the backups to work..it's the way you have to do it. I would suggest just not letting your users have ssh access...that way they can't setup crons...and you won't need cron.allow and cron.deny.
aaron_guitar
I have figured out a way to have Windows automatically download the backups from your server. It uses a combination of DOS's command line FTP and Windows' Scheduler. I don't have time to fully explain everything but the following article (from http://www.tinyapps.org/ftp.html) should give you insight enough to figure out the rest:

QUOTE
An often overlooked feature of the Windows command line ftp program is that it can be scripted. The script is simply a text file containing exactly what you would have typed if using it interactively.

For example, if you create a text file called "updatewebsite" containing something similar to this:

lcd mylocalwebpages
open someftpserver.somedomain.org
myusername
mypassword
cd httpd/docs
prompt
mput *.html
binary
mput *.jpg
mput *.png
bye  

you can then update your web site by typing this at the command line:

ftp -s:updatewebsite


My text file looked something like this:

lcd c:directory_where_you_want_backups_stored
o your_ip_address
admin
your_password
cd /dump1
prompt
mget *.*
bye

And to run the script through the scheduler I used this command:

c:windowsFTP.EXE -s:c:locationoftextfilebackup_server.txt


Anyways, hope that is useful to someone.

Aaron
JLChafardet
i am not using cron for backup procedures, i am backing up manually just to try to install psa 7.0.1

now i am issuing this command (thanks nighthawlk

/usr/local/psa/bin/psadump -F -f - --nostop | gzip | split -b 1000m - dump.


It is suposed to create a gziped file, but i see is a dump.aa file

i have only 9 domains on the server.

if i install plesk 7.0.1 and it screw up my server, can i restore it with the backup and will be back to normal?

what sould i backup and how to perform my task?

all the help is apreciated.
autoquartz
I got a secondary HDD and thought of keeping the backups for 2 weeks. I ran it using the original cron.daily/zzbackup and figured that it is a bit slow to move the 300MB+ dump.aa through the 14 folders, thus I came out with this. It has been working for me so far. Gurus out there, please let me know if you find any problem with this script. cool.gif

First I created
/backup/psabackup/psadump01 to
/backup/psabackup/psadump14 directories (or however many you would like to keep).

---
#!/bin/bash
#
# Local Backups with gzip
# modified by .autoquartz. on 2004-04-28

cd /backup/psabackup/`/bin/ls -t1 /backup/psabackup/ | tail -1`
/usr/local/psa/bin/psadump -F -f - --nostop --tar-ignore-failed-read | gzip | split -b 1000m - dump.
---
NightHawk
QUOTE
Originally posted by JLChafardet
i am not using cron for backup procedures, i am backing up manually just to try to install psa 7.0.1

now i am issuing this command (thanks nighthawlk

/usr/local/psa/bin/psadump -F -f - --nostop | gzip | split -b 1000m - dump.


It is suposed to create a gziped file, but i see is a dump.aa file

i have only 9 domains on the server.

if i install plesk 7.0.1 and it screw up my server, can i restore it with the backup and will be back to normal?

what sould i backup and how to perform my task?

all the help is apreciated.


Yes, it is gzip'd...it just has the .aa extension becuase of the split command..

and sure...you could use this backup to restore your sites to normal...I am guessing you have a plesk6.0.2 box...so you would have to reinstall plesk6.0.2 first...

anyway..you probably have this done already....so it probably worked without a hitch...
NightHawk
QUOTE
Originally posted by autoquartz
I got a secondary HDD and thought of keeping the backups for 2 weeks.  I ran it using the original cron.daily/zzbackup and figured that it is a bit slow to move the 300MB+ dump.aa through the 14 folders, thus I came out with this.  It has been working for me so far.  Gurus out there, please let me know if you find any problem with this script. cool.gif

First I created  
/backup/psabackup/psadump01 to
/backup/psabackup/psadump14 directories (or however many you would like to keep).

---
#!/bin/bash
#
# Local Backups with gzip
# modified by .autoquartz. on 2004-04-28

cd /backup/psabackup/`/bin/ls -t1 /backup/psabackup/ | tail -1`
/usr/local/psa/bin/psadump -F -f - --nostop --tar-ignore-failed-read | gzip | split -b 1000m - dump.
---


That should work...not a bad idea...my script was just a simple way to knock it out....

btw, I would recommend clearing out the old backup in the directory before you run it again...probably not 100% nessecary..but just something I always do.
md3v
Hi,

We had a primary disk failure on our server and we just got through with a restore on the box. We have a second partition which wad mounted as /home2.

Our original backup script was:

#####
###local backups on a box with 2 HD's
###put this script in cron.daily
###must have 2nd HD mounted as /home2 for this to work
#####
#!/bin/bash
/bin/rm -Rf /home2/dump3
/bin/mv /home2/dump2 /home2/dump3
/bin/mv /home2/dump1 /home2/dump2
/bin/mkdir /home2/dump1
cd /home2/dump1
/usr/local/psa/bin/psadump -F -f - --nostop --tar-ignore-failed-read | gzip | split -b 1000m - dump.

####################################
###end of include###################
####################################

I am trying to restore using:

#####
###restore procedure
### for gzip backups
#####
cd /
cat dump.* | gzip -d | /usr/local/psa/bin/psarestore -m map_file -s shells_map_file -f -
vi map_file
vi shells_map_file
cat dump.* | gzip -d | /usr/local/psa/bin/psarestore -m map_file -s shells_map_file -f -
####################################
###end of include###################
####################################

NOTE: I have moved the dump.aa file from the slave to the root /

Anyway, when I run the recovery script all that comes out is:

~
~
~
~
~
~
~
~

I have installed the psa backup kit etc. etc. We urgently need to get this data back into the system...

What is wrong with the scripts or my use of them?!
md3v
I ended up running this, manually...

cat dump.* | gzip -d | /usr/local/psa/bin/psarestore --force -m map_file -s shells_map_file -f -

And its dumping at the moment.
msteudel
If you are running the back from rescue mode, and yo have to mount your drives, you'll need to chroot before running the backup command line:

let's say you mounted drive to /mnt

then do

chroot /mnt
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.