davej Posted October 31, 2015 Share Posted October 31, 2015 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 Link to comment Share on other sites More sharing options...
davej Posted November 1, 2015 Author Share Posted November 1, 2015 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 {} ; Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now