• The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Question Download Plesk Backups

olivenoel

New Pleskian
I would like to download my created plesk backups programmatically to my NAS.
Unfortunately I've no Idea where to begin.

I've following options:
My preferred one: Download backup via https/ftps
or download the backup using ssh, or any other protocoll.

Unfortunately I can not open my NAS to the Internet to work as FTP Server.

May you could provide some starting points which interfaces plesk provides?

Many thanks!
 
Hi Igor,
thanks for your reply! Unfortunately I can not open my NAS to be access from the Internet. Therefore I can not access it from Plesk.
Since the NAS is able to access the internet (But can not be access from it!), I need a more passive method to receive the backups.

Is there any interface/skript available?
 
Even if this might be a Solution, Dropbox only offers 2 GB for Free. Since each of my Backup has a size of almost 20GB (increasing), I can't use it.
 
Even if this might be a Solution, Dropbox only offers 2 GB for Free. Since each of my Backup has a size of almost 20GB (increasing), I can't use it.
You can set backups to be stored on remote server by Ftp or ftp over ssh..and than you can download backups from NAS...I think you can find free provider who offer ftp/sftp uplods or you can even use your own server for this
But to be honest..it is lot of traffic...
 
Obviously that solution should be implemented on NAS side. Maybe some kind of scheduled task for wget, ftp or scp downloading backup files from Plesk server.
 
I also thought about saving the backups to a local ftp server (on same server). But this sounds to me a bit overloaded.
a wget/ftp/scp download would be appreciated. But where to download from?

I know for scp, that my backups are stored in /var/lib/psa/dumps , but I'm not sure which files I do need, to be able to restore the backup afterwards again.
 
You can list all files with command ls /var/lib/psa/dumps ,again 20gb is a lot of traffic and space also, so you are very limited when it comes to this,you can find providers who offer even 50 GB for free and also provide FTP and SFTP(ftp over SSH) and you can use for backup storage but i'm not sure how much bandwith they provide for free(maybe worth to check)..At this way you could avoid local storage and still be able to download your backup from NAS side since they all provide option where you can generate link for downloads....probably for extra few bucks you could resolve this...in past I used one provider for remote FTP storage but I don't remeber how much they offer in free plan,I will check and post here plan details in few minutes
 
thanks sanel.
I would like to avoid involving 3rd party services into this process, since this is only an additional point of failure.
Therefore I would like to work with ootb tools.

I'm aware how to list files inside an directory - many thanks. But I do not know yet which files I need to "pack"/download to have an complete backup and how to restore it (completely or partially).
 
Plesk stores all info about backups in xml file ..looks like backup_info_xxxxxxxx.xml ,if you open it you will find all info..among other fils included in package...but you will spot all files belong to same backup by number at the end ...ie ...156665656.tgz
 
Last edited:
Example,
2016_12_19_10_57_19_root_vm3.png
 
Here is the script.
Unfortuantely net backu is just around 1.7 MB big. Expected filesize is around 18 GB:
Code:
echo "============================================="
echo "[+] Starting backup $(date)"
TMPSTAGE=/tmp/plesk-backup
THISHOST=$(hostname)
#clean up old tmp
echo "[+] Cleaning up old tmp files"
rm -rf $TMPSTAGE
# Get the latest backup with prefix
BKTIMESTAMP=$(basename $(ls -t /var/lib/psa/dumps/backup_*.xml | head -n 1) | perl -pe 's/^.*_([0-9]{10})\.xml$/$1/')
echo "[+] Latest time stamp: $BKTIMESTAMP"
BKFILES=$(find /var/lib/psa/ -type f -name backup_*$BKTIMESTAMP*)
BKDIRS=$(find /var/lib/psa/ -name backup_*$BKTIMESTAMP* -exec dirname {} \; | sort | uniq)
if [ -d /var/lib/psa/dumps/.discovered ];then
    BKDISCOVERED=$(find /var/lib/psa/dumps/.discovered -type d -name backup_*$BKTIMESTAMP* | sort | uniq)
else
    BKDISCOVERED=""
fi
BKDOMAINDISCOVERED=$(find /var/lib/psa/dumps/domains/*/.discovered -type d -name backup_*$BKTIMESTAMP* | sort | uniq)
for d in $BKDIRS
do
        if [ ! -d "$TMPSTAGE"$d ]; then
        echo "[+] Creating tmp dir: "$TMPSTAGE"$d"
        mkdir -p  "$TMPSTAGE"$d
        fi
done
for f in {$BKFILES,$BKDISCOVERED,$BKDOMAINDISCOVERED}
do
        ln -s $f $TMPSTAGE/$f
done
echo "[+] Packing to zip $(date)"
tar -cvzf $TMPSTAGE/daily_plesk_$THISHOST_$BKTIMESTAMP.tgz $TMPSTAGE/var/lib/psa/
echo "[+] Finished packing zip $(date)"

You see what's wrong?
 
Back
Top