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
I just noticed I had the wrong information in there the whole time. Nothing should be uploaded below the public_html directory in regards to this tutorial. I have fixed my mistake now and 755 is perfectly secure. I don't think your cron will work like that because it will try executing the cron job as a PHP script and not a bash script. Sad
(2010-01-06, 09:46 PM)KuJoe Wrote: [ -> ]I just noticed I had the wrong information in there the whole time. Nothing should be uploaded below the public_html directory in regards to this tutorial. I have fixed my mistake now and 755 is perfectly secure. I don't think your cron will work like that because it will try executing the cron job as a PHP script and not a bash script. Sad

Argh no!!!
I can't remove it...
But I'll try and report back.
I'll ask the host.
Ok, what am I doing wrong here? I'm not getting any emails/error messages. I first thought I had the server time wrong so I set it to run every few minutes to test...still nothing. Username and DB name are the same...is that a prob?

/usr/bin/mysqldump -hlocalhost -umyname_mybb -pxxxxxxxxxx myname_mybb | gzip > /home/myname/dbbackup/mybb.sql.gz

File is named crondb, removed .txt extension. Script is CHMOD to 755, dbbackup folder is CHMOD to 666

Path to script is
/home/myname/crondb

Hosting is shared on SharkSpace, with cPanel ver. 11.25.0-RELEASE.
OS Linux, theme x3, MySQL version 5.0.89-community, Apache version 2.2.14, cPanel Pro 1.0 (RC1)
Can you try to chmod the dbbackup folder to 755? I've encountered a few weird shared hosting servers where 666 didn't work for some reason.
Okay, just tried this myself...

/usr/bin/mysqldump -hlocalhost -umyname_forum -pxxxxxxxxxxxx myname_db | gzip > /home/myname/backups/lasthourlybackup.sql.gz

file named hourlybackup, no .txt extention, CHMOD 755 though much of this should be unneeded information in a minute

path
/home/myname/hourlybackup

In ran, but here's what I got via email
Usage: mysqldump [OPTIONS] database [tables]
OR     mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]
OR     mysqldump [OPTIONS] --all-databases [OPTIONS]
For more options, use mysqldump --help
/home/myname/hourlybackup: line 1: [Q: command not found
/home/myname/hourlybackup: line 1: /home/myname/backups/lasthourlybackup.sql.gz: No such file or directory

Figured the last line of that was my own stupidity (not creating the directory), so I have created the directory and it is CHMOD 755 now. What about "[Q: command not found" though?
Very strange. I have no idea where that "[Q:" is coming from. From the message it looks like the problem is with one of the options. Does your username, password, or forum have a "Q" or symbols in it by chance?
Yes, it did. In fact it had "[Q" in it (password generator), and I hadn't thought to look at that before. I created another account (with access to the database) with a dangerously simple password for testing purposes. It looks like it worked, but it stopped notifying me (?). I suppose if the password was the problem it's not too hard to fix (though it might be worth noting as some password generators will use that and other characters).
It's only supposed to notify you if there is some form of output (such as an error). If you want an e-mail each time it is run add a second line with something like the following:
echo "Database Backup Complete."
Nah, I don't need a notification each time it completes...just wanted to make sure that wasn't a sign of another problem. Looks like all's well now. Thanks.
That was weird about the password issue though. I normally use randomly generated passwords for my backup accounts, I guess I will keep that in mind next time I create one. Smile And the fact that you don't get an e-mail is a good thing, you're probably like me and only want to be notified when there is a problem. Wink
Pages: 1 2 3 4 5 6 7 8 9