Romantic Robot Working on it.

15:20 Wed 6 Jul 2005

The Cron Script

Filed under: Programs,WordPress — 15:20 Wed 6 Jul 05

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 –
Kyle –
Westi –
Any blame is all mine.

Apart from that, go keep your data safe :)


  1. Awesome job, Mark! I can’t wait to implement it on my WP databases! :love:

    Comment by Bryan — 18:26 Wed 6 Jul 2005 @ 18:26 Wed 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 > /dev/null

    Hint: to run CGI files, enter the command as follows (modify to fit your needs):
    GET > /dev/null

    There is no hint for a .sh file. May I use Should I include de null directive? Besides, the panel has a field for the e-mail address. Is compatible with my server?

    Comment by nomad — 00:59 Fri 8 Jul 2005 @ 00:59 Fri 8 Jul 05

  3. Backing up WP using Cron

    The WP resource that is Mark provides a handy auto-backup script.

    Trackback by If..Else Log — 02:47 Fri 8 Jul 2005 @ 02:47 Fri 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.

    Comment by Mark — 08:45 Fri 8 Jul 2005 @ 08:45 Fri 8 Jul 05

  5. Mark,

    Got an error:

    /home/site/etc/ line 44: syntax error near unexpected token `else’
    /home/site/etc/ line 44: `else’

    Comment by nomad — 19:40 Fri 8 Jul 2005 @ 19:40 Fri 8 Jul 05

  6. Mark I’m new to shell script but there is something weird here:

    mail -s “MySQL Backup” -a backup-$DATE.sql.gz $MAILADDR
    echo ‘Your mySQL Backup is attached’ | mutt -a backup-$DATE.sql.gz $EMAIL -s “MySQL Backup”
    rm backup-$DATE.sql.gz


    Is that correct?

    Comment by nomad — 20:00 Fri 8 Jul 2005 @ 20:00 Fri 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!

    Comment by Mark — 20:25 Fri 8 Jul 2005 @ 20:25 Fri 8 Jul 05

  8. Fixed. It should work now.

    Comment by nomad — 22:25 Fri 8 Jul 2005 @ 22:25 Fri 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! […]

    Pingback by All Narfed Up » Blog Archive » Automatic WP backup with Cron — 21:23 Tue 25 Oct 2005 @ 21:23 Tue 25 Oct 05

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress