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

Ernesto Baschny [cron IT] ernst at cron-it.de
Thu Jan 3 16:31:49 CET 2008


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




More information about the TYPO3-dev mailing list