The Cron Script
15:20 Wednesday 6 Jul 05
http://www.tamba2.org.uk/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 :)
Comments (9) --
Read (4023)










1
Awesome job, Mark! I can’t wait to implement it on my WP databases! :love:
18:26 Wednesday 6 Jul 05
2
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?
00:59 Friday 8 Jul 05
3
Backing up WP using Cron
The WP resource that is Mark provides a handy auto-backup script.
…
02:47 Friday 8 Jul 05
4
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.
08:45 Friday 8 Jul 05
5
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’
19:40 Friday 8 Jul 05
6
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?
20:00 Friday 8 Jul 05
7
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!
20:25 Friday 8 Jul 05
8
Fixed. It should work now.
22:25 Friday 8 Jul 05
9
[...] Mark did an awesome job with a few people to help create a script to automate the backup of a WordPress database. I haven’t tried it yet, but I’m hopeful that it’ll work. Sweet! [...]
21:23 Tuesday 25 Oct 05