http://www.romanticrobot.net/wordpress/cron
I’ve tested this nightly for a week or so and I’ve used it many more times when testing. I announced it to the A Small Orange forums a couple of days ago (at that time the mail command was limited and did actually work on ASO) and so far all is good. Heed the warning though – if you are unsure about cron, talk to your host !
Credits must go to these guys for their help and advice:
Justin – http://www.wantmoore.com
Kyle – http://www.kylev.com
Westi – http://www.ftwr.co.uk/blog
Any blame is all mine.
Apart from that, go keep your data safe 🙂
Awesome job, Mark! I can’t wait to implement it on my WP databases! :love:
My Cpanel (Version 10.0.0-RELEASE 149) has the following hints in the cron panel:
Hint: to run PHP files, enter the command as follows (modify to fit your needs):
GET http://yourdomain.com/path_to_file/file.php > /dev/null
Hint: to run CGI files, enter the command as follows (modify to fit your needs):
GET http://yourdomain.com/cgi-bin/path_to_file/file.cgi > /dev/null
There is no hint for a .sh file. May I use cronjob.sh? Should I include de null directive? Besides, the panel has a field for the e-mail address. Is cronjob.sh compatible with my server?
nomad – it should be just fine.
The email address is there as well as in the script. I would install it as I have said, but set it for every hour – then wait until you either get an error message or you get the backup file. It won’t blow up your server 🙂 Your host will be able to advise further.
Mark,
Got an error:
/home/site/etc/cronjob.sh: line 44: syntax error near unexpected token `else’
/home/site/etc/cronjob.sh: line 44: `else’
Mark I’m new to shell script but there is something weird here:
if
mail -s “MySQL Backup” -a backup-$DATE.sql.gz $MAILADDR
else
echo ‘Your mySQL Backup is attached’ | mutt -a backup-$DATE.sql.gz $EMAIL -s “MySQL Backup”
then
rm backup-$DATE.sql.gz
fi
If
else
then
fi
Is that correct?
nomad: Sorry about the error – it was found earlier.
It seems to be a combination of the mail line and then the command use. It works fine on ASO servers but not others – as soon as I get a fix I will post it. Sorry!
Fixed. It should work now.