Jump to content

Recommended Posts

Posted

Looking for a solution for automatic backups. Im moving my site across to a new VPS which only takes daily backups and only stores for one day. Would like to set something up where automatic backups can be made and preferably sent to a destination. Is this possible?

Posted
3 hours ago, Steve Bullman said:

Looking for a solution for automatic backups. Im moving my site across to a new VPS which only takes daily backups and only stores for one day. Would like to set something up where automatic backups can be made and preferably sent to a destination. Is this possible?

I am surprised that this is not possible in the admin panel.  I was told that we use a cron job within the server itself.  Our WP sites are backed up via the admin side though.

Posted

If it isn't a managed server then you can set it up with a cronjob.

#!/bin/bash
BACKUPTIME=`date +%b-%d-%y`
DESTINATION=/root/backup/backup-$BACKUPTIME.tar.gz

echo "Creating backup of database to $SQLDUMP"
mysqldump --single-transaction --quick --databases forum | gzip -9 > $DESTINATION

echo "Dump Zipped up"

echo "Uploading zipped dump to the Amazon S3 bucket…"
nice -n 10 ionice -c2 -n 7 s3cmd put $DESTINATION s3://cdn.myforumDB-backups/

echo "Removing the backup file $SQLDUMP"
rm $DESTINATION

echo "WooHoo! All done"

And for files I have this

#!/bin/bash
BACKUPTIME=`date +%b-%d-%y`
DESTINATION=/root/backups/backup-$BACKUPTIME.tar.gz
SOURCEFOLDER=/srv/http/forum/root/html

nice -n 10 ionice -c2 -n 7 tar -cpzf $DESTINATION $SOURCEFOLDER

echo "Uploading zipped dump to the Amazon S3 bucket…"

s3cmd put $DESTINATION s3://cdn.forum/Files-backups/

echo "Removing the backup file $SQLDUMP"
rm $DESTINATION

echo "WooHoo! All done"

 

Posted (edited)

For a cron job (shared or dedicated server) you can use this line:

mysqldump -u DatabaseUser -p'DatabasePassword' DatebaseName > ExportFileName.sql

Place this into the command space.  You might have to edit this in text wrangler or equivalent.

sample.png.123dc9a0757183ab332afa2745172ca7.png

Edited by jackflash
Posted
On 11/27/2020 at 7:47 PM, Jock3r said:

If it isn't a managed server then you can set it up with a cronjob.


#!/bin/bash
BACKUPTIME=`date +%b-%d-%y`
DESTINATION=/root/backup/backup-$BACKUPTIME.tar.gz

echo "Creating backup of database to $SQLDUMP"
mysqldump --single-transaction --quick --databases forum | gzip -9 > $DESTINATION

echo "Dump Zipped up"

echo "Uploading zipped dump to the Amazon S3 bucket…"
nice -n 10 ionice -c2 -n 7 s3cmd put $DESTINATION s3://cdn.myforumDB-backups/

echo "Removing the backup file $SQLDUMP"
rm $DESTINATION

echo "WooHoo! All done"

And for files I have this


#!/bin/bash
BACKUPTIME=`date +%b-%d-%y`
DESTINATION=/root/backups/backup-$BACKUPTIME.tar.gz
SOURCEFOLDER=/srv/http/forum/root/html

nice -n 10 ionice -c2 -n 7 tar -cpzf $DESTINATION $SOURCEFOLDER

echo "Uploading zipped dump to the Amazon S3 bucket…"

s3cmd put $DESTINATION s3://cdn.forum/Files-backups/

echo "Removing the backup file $SQLDUMP"
rm $DESTINATION

echo "WooHoo! All done"

 

Thanks for this. The second part for the files, is this images etc? If so do I need to back these up beings as i'm using AWS for these anyway?

Posted
7 hours ago, Steve Bullman said:

Thanks for this. The second part for the files, is this images etc? If so do I need to back these up beings as i'm using AWS for these anyway?

It's pretty much the whole folder including apps and so on. I just do it to be safe.

Posted
23 hours ago, bfarber said:

This sort of thing typically needs to be done at the server level for anything beyond a very small site. PHP will time out very quickly attempting to back up most databases.

What method would you recommend please

 

Posted

It depends on a lot of factors. Many server administrator scripts such as WHM/cpanel, Plesk, etc. have the ability to take backups on a regular basis already and I'd just use one of those.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...