Jump to content

Auto Mysql Backup


borfast

Recommended Posts

Here's one I'm sure lots of you will appreciate. I sure did appreciate it, being in the middle of studying for college finals and having to set up a database backup system for a client! :dance:

 

You have to edit the bash script to set the database details but don't be scared, the script is very well commented, has pretty good documentation (inside the file) and it's really really easy to configure.

 

It creates daily, weekly and monthly backups, rotating the daily ones at the end of the week. Really good stuff!

 

http://sourceforge.net/projects/automysqlbackup/

 

Enjoy :dance:

Link to comment
Share on other sites

  • 3 months later...

I downloaded automysqlbackup and am able to access it using a cron (i put the automysqlbackup into etc/ ). But I am getting this error:

 

etc/.automysqlbackup.sh: line 572: /bin/mail: Permission denied

 

Were you able to successfully run it? And if so, does it matter which directory it resides in? I do receive the cron email (as set up in the cpanel).

Link to comment
Share on other sites

Well,

I was able to get it working (by not using the send mail feature), but I am unable to use the "mail logs" or "mail attachment" feature within automysqlbackup .

 

I have the backups being built in a directory I created "backups" in the same directory as "etc" "www" .... Is this directory not publicly visible, even by accident, or would somewhere else be more secure?

 

thank you

Edited by musiclc
Link to comment
Share on other sites

  • 5 months later...

An auto-backup script system like this is one of those things I was GOING TO DO, but never got around to it, so I only have a handful of backups done manually whenever I remembered to do it :) (I am sure I am the ONLY one in the world who has been in this situation - joking, of course :P)

 

My site has now been hacked for the second time (the world is full of nice people).

 

So, before I rebuild, I think my lesson is learnt and I better setup something like this auto backup script.

 

Anyway, my question, scripts like this one require CRON. I understand that earlier this year TCH stopped allowing CRON jobs, so therefore I don't think the automatic features and email features of this script will work. (?) What can we use instead of CRON ?

 

On the business side: :yes:

 

I am taking this auto backup matter quite seriously, and Bill, if you are reading this, I would be prepared to pay for a service such as a script like this would provide:

 

- Daily backups

- Emailed backups

 

This sort of service could be an add-on and a differentiator for TCH. If you had enough members interested, it could allow you to keep the costs down - couple of dollars a month ?

Link to comment
Share on other sites

Anyway, my question, scripts like this one require CRON. I understand that earlier this year TCH stopped allowing CRON jobs, so therefore I don't think the automatic features and email features of this script will work. (?) What can we use instead of CRON ?

This is not correct - TCH allows cron jobs and to my knowledge, has never disallowed or disabled them. To set one up, double-click on the 'Cron Jobs' icon in your CPanel.

Link to comment
Share on other sites

My site has now been hacked for the second time (the world is full of nice people).

Sorry to hear that. Yes, some people have no life!

 

Backups are only a part of web site security. Make sure that you are running the latest updated software (wordpress, php-nuke, etc.) and their applicable patches. After all, if you back up the open door that you already have, you'll have the same "welcome mat" out when you restore your site.

Link to comment
Share on other sites

This is not correct - TCH allows cron jobs and to my knowledge, has never disallowed or disabled them. To set one up, double-click on the 'Cron Jobs' icon in your CPanel.

 

Thanks David

 

Now I am confused! I used to run a CRON for MSAnalysis under PHPNuke, for over a year, but it got disabled earlier this year. TCH's response was as follows.

 

31 July 2005

 

Hello,

 

Commands like GET, wget, lynx have been disabled on our servers for security reason. We can not enable it. Please try using curl. Let us know if you need any other clarification.

 

Thanks for choosing TotalChoice Hosting

 

Sincerely,

Kris B

Technical Support

 

To run php via cron, you need to use GET ?

 

Perhaps I am missing something.

Link to comment
Share on other sites

GET, wget, and lynx are system commands that are used to retrieve a file or web page from another server. These commands can be called in a PHP script, and apparently one of the was in your 'MSAnalysis under PHPNuke' cron job script. It is only these commands that have been disabled on the server - not cron jobs as a whole or even php within cron jobs.

 

Your script could modified / rewritten so that it does not use these commands, then it could be used again in a cron job.

 

Hope this helps...

Link to comment
Share on other sites

  • 5 months later...

Has anyone who's been using the automysqlbackup.sh script run into a problem recently? It is now throwing an error for me after having run with no problem for almost 2 months on server 109. I even grabbed the script file from an old site backup (when it ran no problem) and it is now throwing the error below.

 

Tech support says it's probably a syntax error in the script and referred me here. But the script hasn't been touched and now it's failing? Note that the same script is running fine, and has been for 6 months, on Server 5 (same MySQL version 4.1.13-standard) Any suggestions, maybe a server-side change of some sort? -thanks

 

>/home/<username>/etc/automysqlbackup.sh: line 32: 
: command not found
/home/<username>/etc/automysqlbackup.sh: line 35: 
: command not found
/home/<username>/etc/automysqlbackup.sh: line 38: 
: command not found
/home/<username>/etc/automysqlbackup.sh: line 41: 
: command not found
/home/<username>/etc/automysqlbackup.sh: line 45: 
: command not found
/home/<username>/etc/automysqlbackup.sh: line 49: 
: command not found
/home/<username>/etc/automysqlbackup.sh: line 57: 
: command not found
/home/<username>/etc/automysqlbackup.sh: line 60: 
: command not found
/home/<username>/etc/automysqlbackup.sh: line 63: 
: command not found
/home/<username>/etc/automysqlbackup.sh: line 64: 
: command not found
/home/<username>/etc/automysqlbackup.sh: line 68: 
: command not found
/home/<username>/etc/automysqlbackup.sh: line 71: 
: command not found
/home/<username>/etc/automysqlbackup.sh: line 74: 
: command not found
/home/<username>/etc/automysqlbackup.sh: line 77: 
: command not found
/home/<username>/etc/automysqlbackup.sh: line 80: 
: command not found
/home/<username>/etc/automysqlbackup.sh: line 83: 
: command not found
/home/<username>/etc/automysqlbackup.sh: line 86: 
: command not found
/home/<username>/etc/automysqlbackup.sh: line 89: 
: command not found
/home/<username>/etc/automysqlbackup.sh: line 92: 
: command not found
/home/<username>/etc/automysqlbackup.sh: line 307: date: command not found
/home/<username>/etc/automysqlbackup.sh: line 308: date: command not found
/home/<username>/etc/automysqlbackup.sh: line 309: date: command not found
/home/<username>/etc/automysqlbackup.sh: line 310: date: command not found
/home/<username>/etc/automysqlbackup.sh: line 311: date: command not found
/home/<username>/etc/automysqlbackup.sh: line 312: date: command not found
/home/<username>/etc/automysqlbackup.sh: line 314: date: command not found
/home/<username>/etc/automysqlbackup.sh: line 317: 
: command not found
/home/<username>/etc/automysqlbackup.sh: line 350: syntax error near unexpected token `{ '
/home/<username>/etc/automysqlbackup.sh: line 350: `dbdump () { '

Link to comment
Share on other sites

  • 3 weeks later...

dude,

 

I read the script and i dont think is worth the time discussing or editing the script

 

You can do this.

 

/usr/bin/mysqldump is normally having execute permission and if TCH has not changed it :)

 

 

you can run this from bash .

 

mysqldump --databases DB1 DB2 ....... > $HOME/mysqltestdump.`date +%d-%m-%Y`

 

 

 

this will create dumps when ever you run the above command, and if you need to delete previous older ones, its just a couple of lines .

 

No need for the script being discussed above :)

 

Anand S

Earlier remote sysadmin

Link to comment
Share on other sites

Anand,

 

Welcome to the forums! If you have any questions about if a certain script would be allowed, I'd recommend that you contact the help desk, or send a PM to one of the RED staff members. They should be able to respond to specific scripts that would be allowed or disallowed as per the AUP.

 

Don't be a stranger in the forums! :notworthy:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...