MyBB Community Forums

Full Version: HOW TO: Automated database backups (1 line of code + cPanel)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9
How long it takes, usually for database dump 250MB (compressed) or 1.1GB SQL? Smile
Is forum still running during backup? What happen in database (like table lock/wait) during that time?
Forum will still run, time depends on your server specs.
(2008-02-23, 03:15 AM)KuJoe Wrote: [ -> ]EACH DAY @ 1:15AM YOUR BACKUP WILL BE OVERWRITTEN!
Is possible to make it to not overwrite the old one?
Like in the title of the backup it will set the date and it wont overwrite the other ones.
Is that possible?
Yes. At the top of your script put:
NOW="$(date +"%m%d%Y")"

And for your backup name:
/MY/BACKUP/LOCATION/BACKUPNAME_$NOW.sql.gz
Like this?
NOW="$(date +"%m%d%Y")"
/usr/bin/mysqldump -hDBHOST -uDBLOGIN -pDBPASSWORD DATABASE | gzip > /MY/BACKUP/LOCATION/BACKUPNAME_$NOW.sql.gz
uuencode /MY/BACKUP/LOCATION/BACKUPNAME_$NOW.sql.gz BACKUPNAME_$NOW.sql.gz | mail [email protected]

Mhmm do I have to change the DBHOST with my database host keeping the CAPS?


KuJoe Wrote:DATABASE = The database you wish to backup.
This is the database name?
Yes that looks correct.

Your DB host should be localhost unless your provider tells you otherwise and it's best to avoid caps unless it is specifically written in caps. I used caps so it stood out better for those reading it.

Yes, the database name.
Thanks Joe, It works like a charm here Smile
(2010-01-06, 02:48 PM)KuJoe Wrote: [ -> ]Yes that looks correct.

Your DB host should be localhost unless your provider tells you otherwise and it's best to avoid caps unless it is specifically written in caps. I used caps so it stood out better for those reading it.

Yes, the database name.
Thank you.
I have created the "backup" folder above the public_html and I can't CHMOD it to 666. It changes to 766... What CHMOD I have to insert for the backup folder?
Any CHMOD above 666, so 766 will work.
(2010-01-06, 03:52 PM)KuJoe Wrote: [ -> ]Any CHMOD above 666, so 766 will work.

Thank you.
Is this ok?
[attachment=16871]
The "php -f /home/a3230294/" part was already there and I can't delete it..


KuJoe Wrote:Upload the file to your site below the public directory and remove the extention (.txt). Change the permission of the file to allow it to be executed. CHMOD 755 works.
CHMOD 755 will allow user form outside to read the file...
CHMOD 733 works?
Pages: 1 2 3 4 5 6 7 8 9