Easy Database Backup Script

Do something cool with CMS? Show us ...
This board is for 'Answers', and the discussion of answers... Not for questions.
citizenine

Re: Easy Database Backup Script

Post by citizenine »

Elijah --

It works great! Many, many thanks. (I bumped your karma :))

I had it working (i.e., I was getting the "Database backup created and sent!" message on my screen when I ran it manually) but the email was not arriving. I had been under the impression that the code didn't need any personalization because it picked up everything necessary from my cmsms config.

I found that if I replaced "youremail@example.com" with my email address in the top lines of the code, it worked fine. (My config.php doesn't have my email address.)

Also, when I set the cron job using cPanel, it asks for my email address. So between the two email specifications it is now working fine as a cron job.

Nota Bene: For anyone setting up a cron job, be sure to append "> /dev/null" to the example given above, so it looks like this:

php /home/your_name/public_html/backups/backup-database-cron.php > /dev/null
(as mentioned above by chilsta)

It's also worth noting that in setting the time for the cron job, the time specified will be local time for the location of the server, not necessarily of the user.

Thanks, again, Elijah.
Last edited by citizenine on Tue Jun 26, 2007 1:30 pm, edited 1 time in total.
tigercat

Re: Easy Database Backup Script

Post by tigercat »

I stored the script in a plain php file in my CMS directory (first attempt with cron jobs (confixx) did not work). At the moment don`t know why.

Backup fails because my provider does not allow exec like skypanther also mentioned. Is there any possiblility to get your script working, Elijah?

Executing the script was only possible on root level of CMS (not in subfolder like recommended).

Thanks.
User avatar
Elijah Lofgren
Power Poster
Power Poster
Posts: 811
Joined: Mon Apr 24, 2006 1:01 am
Location: Deatsville, AL

Re: Easy Database Backup Script

Post by Elijah Lofgren »

Hi Tigercat,
tigercat wrote: Backup fails because my provider does not allow exec like skypanther also mentioned. Is there any possiblility to get your script working, Elijah?
Sorry, I can't help you here, my web host allows it and I don't have time to look around for a workaround.
You may want to try one of these modules which you can use to manually backup your database:
http://dev.cmsmadesimple.org/projects/mysqldump/
http://dev.cmsmadesimple.org/projects/databasebackup/

Hope this helps,

Elijah
Note: I don't have time to take on any more projects. I'm quite busy. I may be too busy to reply to emails or messages. Thanks for your understanding. :)
tigercat

Re: Easy Database Backup Script

Post by tigercat »

Hi there Elijah.

Ok, I'll give them a try ;-)
Let's find out if it works for me. Anyway the summary of mysqldump on http://dev.cmsmadesimple.org/forum/foru ... rum_id=812 sounds good.

Regards.
Franz
New Member
New Member
Posts: 9
Joined: Tue Oct 09, 2007 7:51 am
Location: Verona

Re: Easy Database Backup Script

Post by Franz »

Great job, thanks!!!  :)
Post Reply

Return to “Tips and Tricks”