Page 2 of 2

Re: Automatic database Backup

Posted: 15 Mar 2017, 18:00
by Ilovecats
Thanks and I will try this tonight.

I've always just backed up the OpenCATS directory manually. What is Backingup your MySQL/MariaDB database doing ?

Re: Automatic database Backup

Posted: 16 Mar 2017, 09:44
by cptr13
The database is all of the actual information.

The directories are the program and resumes.

You need both for a successful restore.

The gui (full) backup, backs up both.

Re: Automatic database Backup

Posted: 16 Mar 2017, 10:15
by cptr13
Ok. I THINK...this will encompass a fully automated backup in Windows. I will write this up and simplify this in the documentation at some point. For now, these are the instructions to do it.
1) Backup the OpenCATS MySQL database
https://www.tectut.com/2016/04/automati ... n-windows/

2) Backup the OpenCATS Directories:
https://www.winhelp.us/configure-automa ... ows-7.html

I would recommend, setting the database backup to run first. Then running the step 2 backup to include the OpenCATS directories AND the mysql backup file from step 1.

This should give you a full backup, automatically run and placed on an external hard drive.

WARNING: You must, must must must to a test restore to make sure everything is working. I would recommend doing an occasional test restore on an ongoing basis. You don't want to be caught with a bad backup when you need it....

Re: Automatic database Backup

Posted: 11 Oct 2017, 21:58
by kevinharper
I need a solution for a non-technical client that automates the backup process on Unix (Dreamhost). Since OpenCATS already has a full backup feature, it seems like it would be easy to create a script that:

1) Creates a full backup of OpenCATS on a schedule I can determine. Preferably hourly for 24 hours, then daily for a month.
2) Timestamps the zip file for future download.
3) Emails a copy of the zip file if desired, or uploads to Dropbox, FTP, etc.

Has someone created something like this already, or would someone be interested in doing so? Please PM me.

My idea would be to write a bash script then put it on a cron job. I'm not a trained coder, but could probably hack my way through some of this, but if someone has already done it, or can offer pointers, your assistance will be appreciated. :-)

Re: Automatic database Backup

Posted: 12 Oct 2017, 19:14
by cptr13
I'm not aware of anything like this. If you put something together please share it. There's a lot of folks using shared-hosting. I'm sure it could be tweaked and used.

Re: Automatic database Backup

Posted: 14 Oct 2017, 02:39
by kevinharper
Here is what I have so far. I put this on a cron that runs every other hour during business hours M-F. The script generates a Gzip MySQL backup and a Zip full file backup. It then checks and removes any backups older than 7 days.

I added this to GitHub in case others want to improve it.

https://github.com/kmharper/opencats-autobackup
Code: Select all
#!/bin/sh
#
# OpenCATS Autobackup v0.0
# By Kevin Harper
# ResultsInternet.com
# kevinmharper@gmail.com
# 
# This script creates a MySQL backup and Gzips it, creates a full file backup
# and zips it, then deletes backups older than 7 days. Place it on a cron and
# schedule to your preferences.
#
# Set MySQL credentials
#
THEHOST="mysqlhost.com"
THEDB="mysql_db"
THEDBUSER="mysql_user"
THEDBPW="mysql_pass"
THEDATE=`date +%d%m%y%H%M`
#
# Set other variables
#
THESITE="livesite.com"
THEBACKUPPATH="/path/to/backups/"
THESITEPATH="/path/to/livesite.com"
#
# Make MySQL backup
#
mysqldump -h $THEHOST -u $THEDBUSER -p${THEDBPW} $THEDB | gzip > ${THEBACKUPPATH}${THESITE}_mysql_${THEDATE}.gz
#
# Make file backup
#
zip -r ${THEBACKUPPATH}${THESITE}_files_${THEDATE}.zip ${THESITEPATH}
#
# Remove backups older than 7 days
#
find ${THEBACKUPPATH}${THESITE}* -mtime +7 -exec rm {} \;

Re: Automatic database Backup

Posted: 20 Oct 2017, 23:53
by kevinharper
@cptr13 True, but this install is on a shared server environment. Dreamhost. So far, the script I posted for automating this is working beautifully. I'd like it to be a little more elegant for non-technical users to download and restore from a backup, but I at least have peace of mind. :)

Re: Automatic database Backup

Posted: 05 Aug 2018, 00:12
by caines1989
Hey Kevin do you have a step by step tutorial on how to do this please?

Re: Automatic database Backup

Posted: 26 Oct 2019, 05:06
by copiousquirk
Is there a way to do automatic full database backups on a hosting site through godaddy ?