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

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


Steffen Kamper wrote: on 03.01.2008 16:30:
> "Martin Kutschker" <martin.kutschker-n0spam at no5pam-blackbox.net> schrieb im 
> Newsbeitrag 
> news:mailman.1.1199370737.23915.typo3-dev at lists.netfielders.de...
>> Steffen Kamper schrieb:
>>> Hi,
>>>
>>> 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.
>>
>> Masi
> 
> Hi,
> 
> what is the disadvantage of this way? Looking to cli_dispatch it does nearly 
> the same, and i did successfully running cronjobs my way (it's also same as 
> indexed_search does)

The advantage is that your module won't need to fiddle with BACK_PATH,
bizarre relative "../../.." that most people don't understand, bizarre
techniques for getting the absolute path of your cli
(define('PATH_thisScript',$_ENV['_']?$_ENV['_']:$_SERVER['_']);), etc.
This is all done via cli_dispatch already, and you can concentrate on
your task (the functionality of your CLI).

Also think that sometime cli_dispatch might be implemented differently,
or there might be other interfaces to your CLIs. Using the API is the
only way to ensure that "your cli" will conform in future.

Cheers,
Ernesto




More information about the TYPO3-dev mailing list