[Labs-l] Having some trouble running a cronjob

Tim Landscheidt tim at tim-landscheidt.de
Sun Jan 3 21:33:08 UTC 2016


(anonymous) wrote:

> i'm trying to run a cronjob on Tool Labs, but i'm having some issues.

> My crontab looks like this:
> 0 * * * *  jsub -N cron-tools.hay-1 -mem 700m php
> /data/project/hay/lib/crawl-tools.php

> This is the cronjob updating the Tools Directory. It doesn't seem to
> update things. When i look at the cron logs, i see this error:

> PHP Parse error:  syntax error, unexpected '[' in
> /data/project/hay/lib/class-directoryapi.php on line 46

> Line 46 states:
> $tools = [];

> So, the only thing i could think of is that for some reason a
> deprecated PHP version that isn't supporting the shortened array
> syntax (available since 5.4) is running cronjobs. But when i run the
> php command from the shell

> $ php --verson

> I get 5.5 as the version, and running the task directly

> $ php /data/project/hay/lib/crawl-tools.php

> Works perfectly fine.

> I tried looking at the help pages, but i can't find any solution there.

When you do not pass "-l release=precise" or "-l
release=trusty" to jsub, the grid assumes that the job will
run on both releases and chooses one by availability.  In
your case, it has picked Ubuntu Precise ones ("qacct -j
cron-tools.hay-1"; host names with numbers "-12xy" are Pre-
cise (Ubuntu 12), "-14xy" mean Trusty (Ubuntu 14)).  Precise
has PHP at:

| PHP 5.3.10-1ubuntu3.21 with Suhosin-Patch (cli) (built: Oct 28 2015 01:43:56) 
| Copyright (c) 1997-2012 The PHP Group
| Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
|     with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans

To ensure that your job runs (only) on Trusty and thus:

| PHP 5.5.9-1ubuntu4.14 (cli) (built: Oct 28 2015 01:34:46) 
| Copyright (c) 1997-2014 The PHP Group
| Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
|     with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
|     with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans

add a "-l release=trusty", i. e.:

> 0 * * * *  jsub -N cron-tools.hay-1 -l release=trusty -mem 700m php /data/project/hay/lib/crawl-tools.php

Tim




More information about the Labs-l mailing list