[TYPO3-dev] HowTo: Running a cronscript using TYPO3 with CLI

Steffen Kamper steffen at sk-typo3.de
Thu Jan 3 16:54:09 CET 2008


"Ernesto Baschny [cron IT]" <ernst at cron-it.de> schrieb im Newsbeitrag 
news:mailman.1.1199374308.6833.typo3-dev at lists.netfielders.de...
> Martin Kutschker wrote: on 03.01.2008 15:32:
>
>>> i searched for detailed information how to setup a CLI cronjob, but i
>>> only found uncomplete infos or unanswered questions, so here comes a
>>> short description how to do it.
>>
>> Please don't do it this way. Use the script typo3/cli_dispatch.php to
>> launch your script.
>
> "Inside TYPO3" describes the old-school way Steffen describes. It looks
> pretty "complete" to me:
>
> http://typo3.org/documentation/document-library/core-documentation/doc_core_inside/4.1.0/view/3/5/#id3561750
>
> but unfortunately this is "old-school". As Masi said, using
> typo3/cli_dispatch.php is the "way to go". Someone has to change that
> section in "Inside TYPO3" to reflect that, as I don't see cli_dispatch
> documented anywhere.
>
> You can follow the examples in the sysext/lowlevel. Basically this means:
>
> => BE-user "_CLI_lowlevel". This user has to have the rights you need
> the script to have. So if the script performs high-level TCEmain
> operations, it needs to have access to the fields you want to change!
>
> => ext_localconf.php:
> $TYPO3_CONF_VARS['SC_OPTIONS']['GLOBAL']['cliKeys']['lowlevel_cleaner']
> = array('EXT:lowlevel/dbint/cli/cleaner_cli.php','_CLI_lowlevel');
>
> => lowlevel/dbint/cli/cleaner_cli.php:
> Straight PHP-code where you already have the TYPO3-framework loaded (no
> more BACK_PATH stuff etc). Just "do your stuff" here.
>
>
> Then call your stuff with:
> $ php <Root>/typo3/cli_dispatch.phpsh lowlevel_cleaner
>
>
> Cheers,
> Ernesto

Hi Ernesto,

i didn't found this document, thx for the link.
I don't see a BACK_PATH problem, it's same stuff as in every BE-module - 
defined one time and could be used.
I didn't used it, as there is also the way with the constants or 
EXT:xxx-syntax.

Ok, switching to cli_dispatch is no problem, only missing documentation. But 
all is done in lowlevel, so these parts could be copied.
So little additional question, how can I access commandline parameters? e.g. 
i want to start my script this way
/abspath/typo3/cli_dispatch.phpsh mysscript -f 100

vg  Steffen 






More information about the TYPO3-dev mailing list