I’m trying to run a function every 60 minutes using crontab in an elasticbeanstalk environment in AWS, this is my cron:

*/2 * * * * cd /var/www/html; /usr/bin/php /var/www/html/import_jobs_cron.php

The cron is triggered every two minutes successfully(for quicker testing)

The content of the file being run is:

<?php
if ( !defined('ABSPATH') ) {
    /** Set up WordPress environment */
    require_once( dirname( __FILE__ ) . '/wp-load.php' );
}
if (file_exists (dirname( __FILE__ ) . '/wp-admin/includes/taxonomy.php')) {
    require_once (dirname( __FILE__ ) . '/wp-admin/includes/taxonomy.php'); // Ineed this to run an admin function, so I have to include it
}
insert_rexx_jobs();

However, I get this in /var/spool/mail/root

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Database Error</title>

    </head>
    <body>
        <h1>Error establishing a database connection</h1>
    </body>
</html>

Any ideas? Thanks.

0

Tags:

Leave a Reply

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