azirion
azirion

Reputation: 109

How to make automatic backups of mysql db´s on Goddady with Apache servers

Im trying to automate a daily backup of mysql database on a shared hosting with Godaddy.com using Apache servers.

For this I researched and found out about bash scripts.

Goddady hosting lets me do cron jobs also so I did the following:

My bash script looks something like this (I masked the sensible data only):

<br>
#/bin/sh<p></p>
<p>mysqldump -h myhost-u myuser -pMypassword databasename > dbbackup.sql<br>
gzip dbbackup.sql<br>
mv dbbackup.sql.gz _db_backups/`date +mysql-BACKUP.sql-%y-%m-%d.gz`<br>
</p>

I configured the cron job which points to this file and executes it every 24 hours.

I have the cron job utility configured to send me a log message to my email every time it runs.

And this is the log message:

/var/chroot/home/content/01/3196601/html/_db_backups/backup.sh: line 1: br: No such file or directory

/var/chroot/home/content/01/3196601/html/_db_backups/backup.sh: line 3: p: No such file or directory

/var/chroot/home/content/01/3196601/html/_db_backups/backup.sh: line 4: br: No such file or directory

/var/chroot/home/content/01/3196601/html/_db_backups/backup.sh: line 5: br: No such file or directory

/var/chroot/home/content/01/3196601/html/_db_backups/backup.sh: line 6: /p: No such file or directory

Its like it doesn't understand the language. Should I edit my .htaccess file for this? Any ideas?

Upvotes: 0

Views: 614

Answers (1)

&#214;zg&#252;r Eroğlu
&#214;zg&#252;r Eroğlu

Reputation: 1270

Remove those html tags from the bash script, error messages are all related to them . Your script should be as the following.

#!/bin/sh
mysqldump -h myhost-u myuser -pMypassword databasename > dbbackup.sql
rm -rf dbbackup.sql.gz
gzip dbbackup.sql
mv dbbackup.sql.gz _db_backups/`date +mysql-BACKUP.sql-%y-%m-%d.gz`

Upvotes: 1

Related Questions