RFC: Plesk to Amazon S3 backup part 2

#!/bin/sh

CLIENT=client1
OBJECT=domain.nl
BASEDIR=/var/lib/psa/backupscript
BASEDIROBJECT=/var/lib/psa/dumps/.discovered/*_
DATADIR=/var/lib/psa/dumps/resellers/beheer/clients

cd /$BASEDIR
file=”$BASEDIROBJECT$OBJECT”

### bash check if file exists

if [ -f $file ];

### first backup the new stuff

then python s3cmd put -r $DATADIR/$CLIENT/domains/ s3://bucketname/”$CLIENT”_`date +%d%m%Y`/
rm -rf $BASEDIROBJECT$OBJECT
touch “$BASEDIR”/logs/”$CLIENT”_backup-transferred`date +_%d%m%Y`.txt

else echo “nothing to backup”

fi
echo “ready”

So, this is the modified backup script, where I have removed the delete part of the domain, I have created a logfile after ‘successful’ uploading the content, so that with this file you can delete finally the content on the server in another script.
script has not run in crontab yet and I have only adapted it for 1 domain yet. Comments are welcome.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.