Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted November 27, 20204 yr 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?
November 27, 20204 yr 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.
November 27, 20204 yr 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"
November 28, 20204 yr 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. Edited November 28, 20204 yr by jackflash
November 29, 20204 yr Author 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?
November 29, 20204 yr 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.
November 30, 20204 yr 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.
December 1, 20204 yr Author 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
December 2, 20204 yr 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.