L. Arnold's picture

I am being told that Cron is not operating in Magento.  Does anyone know the process in TKL to see if it is or is not, and moreover to be sure it is working for Magento as well as the system.

thanks for any and all help.

Forum: 
Jeremy Davis's picture

That's what is used to install the security updates. But I'm not sure about Magento specific cron jobs as I don't use the Magento appliance.

There is a Webmin page that allows you to see what cron jobs are queued and their frequency etc. One anomaly with cron though, is that you either need to load environmental variables, or use the full path to scripts you wish to run from cron.

If there are Magento cron jobs that you think should be runnign by default in the Magento appliance which aren't in TKL Magento, then perhaps you could suggest them via a blueprint or a bug report (depending on how important/required you think they are). Then hopefully they'll be setup by default in the next TKL appliance. Even if they're not super important, if you think they are useful enough, even if the TKL devs don't have them enabled by default, the cron jobs themselves could be included but disabled (so end users can easily enable them).

L. Arnold's picture

Not sure if this should run as User  "root" or "www-data"

also: What does the Magento Cron job that is set up by default do?

Now to check to see if it is running.  Must be some sort of a toggle test or something.

Thanks for the note on this.

Jeremy Davis's picture

So you would enable the system cron to run magento/cron.sh (as www-data) and then from within Magento you configure which jobs run?

@larnold - If that's the case then you could add the system cron job (ie to run /magento/cron.sh) from Webmin. And perhaps that should be the TKL OOTB default setup?

L. Arnold's picture

I just turned on cron logs in Webmin, so that may help.

I have tried to create a manual cron job in Webmin and Magento is not allowing it.

It could be that there are ohter controls in the TKL magento cron file:

#!/bin/bash

/usr/bin/php /var/www/magento/cron.php > /dev/null 2>&1

Not sure why bin/bash is there.  It also appears to be commented out.  If I run the last line as its own command manually I get in webmin:

No output generated

Nothing shows up in the cron log (accessible via webmin)..

I may get the following in my Apache Error log, but the time seems out of kilter:  perhaps London time.

[Thu Dec 01 23:17:44 2011] [error] [client 10.10.10.163] client denied by server configuration: /var/www/magento/app/etc/local.xml

(perhaps local.xml is wanting the DNS to match and the above is the DMZ address not the Domain IP itself...  would seem strange, but perhaps)..  let me see if DNS rewrites are happening.

If I try to run cron.sh directly from the Browser I get it wanting to download...  and if I go open it it is reading like this:

#!/bin/sh
# location of the php binary
if [ ! "$1" = "" ] ; then
CRONSCRIPT=$1
else
CRONSCRIPT=cron.php
fi

PHP_BIN=`which php`

# absolute path to magento installation
INSTALLDIR=`echo $0 | sed 's/cron\.sh//g'`

#    prepend the intallation path if not given an absolute path
if [ "$INSTALLDIR" != "" -a "`expr index $CRONSCRIPT /`" != "1" ];then
    if ! ps auxwww | grep "$INSTALLDIR""$CRONSCRIPT" | grep -v grep 1>/dev/null 2>/dev/null ; then
    $PHP_BIN "$INSTALLDIR""$CRONSCRIPT" &
    fi
else
    if  ! ps auxwww | grep " $CRONSCRIPT" | grep -v grep | grep -v cron.sh 1>/dev/null 2>/dev/null ; then
        $PHP_BIN $CRONSCRIPT &
    fi
fi

If I run Magento's cron.php from the browser I don't see anything in the log, on the screen or anywhere.  It does appear to take some time and "do something", but again, no apache or cron logs.  I will look for some Magento cron logs...

This all feels like TKL is handling cron ok, but not so sure about Magento.  Perhaps Magento has its own Cron, and TKL has another and they are/or are not getting along.

thoughts on this one?

Jeremy Davis's picture

The "#!/bin/bash" is known as a shebang and it is basically tells the script which shell to run (in this case it's bash).

The "> /dev/null 2>&1" basically makes the command run quietly. Generally you want cron jobs to run silently. Have a look here. I'm guessing that's why it says "no output generated".

From what I could gather from Sean's previous posts is that you need to setup the system cron to run the Magento cron script every 5 mins, then you adjust what jobs it actually does from within Magento itself. So basically the system cron that triggers the Magento cron.

Add new comment