Jump to content
Sign in to follow this  
davej

mysqldump

Recommended Posts

I set up cronuser with only mysql SELECT privileges. That's what it says here...

 

http://forums.mysql.com/read.php?10,16482,18349

 

...and I will be using this on a shared hosting account (Hostgator).

 

Any other suggestions?

 

Thanks.

#!/bin/bash #Cron Backup Script #Last updated Oct 31, 2015 NOW=$(date +"%Y-%m-%d") tar cfz ~/backups/backup_$NOW.tar.gz ~/public_html mysqldump -u cronuser -pcronuserpassword databasename | gzip > ~/backups/backupdb_$NOW.sql.gz 

Share this post


Link to post
Share on other sites

First attempt is giving me this error...

/bin/sh: /home4/myacct/backups/bscript.sh: /bin/bash^M: bad interpreter: No such file or directory

--edit--

 

Oh, that is caused by CR-LF characters in the file, which Linux apparently doesn't like. Changing them to Unix-returns fixed it.

 

Have also added another line...

find ~/backups/*.gz -mtime +5 -exec rm {} ;

Share this post


Link to post
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
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.

Loading...
Sign in to follow this  

×
×
  • Create New...