The Cron Script

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 :)

9 thoughts on “The Cron Script

  1. 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?

  2. Pingback: If..Else Log
  3. 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.

  4. 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?

  5. 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!

Leave a Reply

Your email address will not be published. Required fields are marked *