Recent Changes - Search:
Thanks to OZU Thanks to OZU
Linked In

links

Reviews

Admin

edit SideBar

Plesk

Backup and restore with pleask 9

  • /usr/local/psa/bin/pleskbackup --server --skip-logs --suspend --output-file=/var/backup/last2.tgz --prefix=swh
  • /usr/local/psa/bin/pleskrestore restore <backup repository root>/<server>.xml -level server

Backup mysql

  • /usr/bin/mysqldump --user=yyyy --password=xxxx --lock-all-tables --all-databases > /var/backup/backup-sql.sql

How to edit the appache conf file:

in /home/httpd/vhosts/ohds.co.uk/conf/ create a new httpd.conf with just your changes, e.g:

DirectoryIndex index.html index.php

run: /usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=<domain_name>

restart apache.

Done.

Doing Backups with pleask 6/7

This is my plesk server backup script. It backups up plesk and the cron jobs (which psadump stupidly ignores), sends it to another server and emails me the results. You need to setup your /root/.netrc file with your ftp server name and login details. As you can see Im not very practiced in the art of writing shells scripts, so please email me at suggestions @ ohds.co.uk if you have any improvement ideas. Note, I dont split the file as many people do, as redhat 9 quite happily supports 5Gb files and so does the ftp.

BAKDIR=/home/bak
FTPHOST=xxxxx.net
FTPDIR=httpdocs/bak
LOGDIRNAME=`date +%Y-%m-%d-%H:%M:%S`
SUBJ="backup results"
TO=xxxxx@xxxxx.co.uk
cd $BAKDIR
/usr/local/psa/bin/psadump --nostop --nostop-domain -z -f $BAKDIR/ 2> $BAKDIR/psadump.log
tar -cvf $BAKDIR/misc.tar /etc/cron.d /etc/cron.daily /etc/cron.hourly /etc/cron.monthly /etc/cron.weekly /var/spool/cron &> $BAKDIR/misc.log
gzip *.tar
for f in $(ls *.gz); do
ftp $FTPHOST &> $BAKDIR/ftp_$f.log <<EOFTP
bin
cd $FTPDIR
put $f
quit
EOFTP
done
rm *.gz
mkdir $LOGDIRNAME
mv *.log $LOGDIRNAME
tmp=/tmp/status-report-`date +%F`
touch $tmp && chmod 600 $tmp
echo -e "subject: $SUBJ `date +%F`\n" > $tmp
echo -e "\n -- Free Disk Space -- " >> $tmp
df -h >> $tmp
echo -e "\n -- Ram -- " >> $tmp
free -m >> $tmp
echo -e "\n -- Uptime -- " >> $tmp
uptime >> $tmp
echo -e "\n-----------------" >> $tmp
cd $LOGDIRNAME
for f in $(ls); do
echo -e "\n-- $f --" >> $tmp
cat $f >> $tmp
done
cd -
sendmail -f plesk@xxxxx.co.uk $TO < $tmp
rm $tmp

To setup the /root/.netrc create it with the following data:

machine your.machine.com login MY_LOGIN password MY_PASSWORD

You will have to set the permissions on it to "600" I think too.

Restoring Backups.

Assuming you just want to restore back onto the same server, you have to do this command twice (you wont find this in the documentation either):

/usr/local/psa/bin/psarestore -f psa-7.5.2-p15149095.pureserver.info-20060301.02.archive -m ip_map -s shell_map

where ip_map and shell_map dont initially exist (they will be created the first time you run them).

Edit - History - Print - Recent Changes - Search
Page last modified on November 15, 2009, at 03:18 PM