HowTo: Running a cronscript using TYPO3 with CLI

View: New views
3 Messages — Rating Filter:   Alert me  
< Prev | 1 - 2 | Next >

Re: HowTo: Running a cronscript using TYPO3 with CLI

by Ansgar Brauner-3 :: Rate this Message:

| View Threaded | Show Only this Message

Steffen Kamper schrieb:

> Hi Steffen,
>
> it's very easy, here is a very very basic one
> ===============================
> create BE user _cli_cronjob
>
> in ext_localconf.php:
> //register key for cli
> $TYPO3_CONF_VARS['SC_OPTIONS']['GLOBAL']['cliKeys']['mycliscript']=
> array('EXT:myext/croncli.php','_CLI_cronjob');
>
> the croncli.php:
>
> if (!defined('TYPO3_cliMode')) die('You cannot run this script directly!');
>
> require_once(PATH_t3lib.'class.t3lib_cli.php');
>
> class tx_myjobs extends t3lib_cli {
>
>  function main($argv) {
>   $args = $this->cli_getArgArray('-f',$argv);
>   print_r($args);
>  }
> }
>
>  // Call the functionality
> $myObj = t3lib_div::makeInstance('tx_myjobs');
> $myObj->main($_SERVER["argv"]);
> ===============================
>
> then call it on console:
> /var/www/.../typo3/cli_dispatch.phpsh mycliscript -f hello
>
> works.


Guys, you made my day!!!

After searching half of the day for information about the CLI i found
your thread with this easy but excellent example.

Now i can start coding my scripts.

Thanks a lot!

regards

Ansgar
_______________________________________________
TYPO3-dev mailing list
TYPO3-dev@...
http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-dev

Re: HowTo: Running a cronscript using TYPO3 with CLI

by Ingmar Schlecht :: Rate this Message:

| View Threaded | Show Only this Message

I have added a link to this thread to the
http://wiki.typo3.org/index.php/Pending_Documentation#doc_core_api wiki
page, so we're reminded of updating the documentation about
cli_dispatch.phpsh in TYPO3 Core API.

cheers
Ingmar

Ansgar Brauner schrieb:

> Steffen Kamper schrieb:
>> Hi Steffen,
>>
>> it's very easy, here is a very very basic one
>> ===============================
>> create BE user _cli_cronjob
>>
>> in ext_localconf.php:
>> //register key for cli
>> $TYPO3_CONF_VARS['SC_OPTIONS']['GLOBAL']['cliKeys']['mycliscript']=
>> array('EXT:myext/croncli.php','_CLI_cronjob');
>>
>> the croncli.php:
>>
>> if (!defined('TYPO3_cliMode')) die('You cannot run this script directly!');
>>
>> require_once(PATH_t3lib.'class.t3lib_cli.php');
>>
>> class tx_myjobs extends t3lib_cli {
>>
>>  function main($argv) {
>>   $args = $this->cli_getArgArray('-f',$argv);
>>   print_r($args);
>>  }
>> }
>>
>>  // Call the functionality
>> $myObj = t3lib_div::makeInstance('tx_myjobs');
>> $myObj->main($_SERVER["argv"]);
>> ===============================
>>
>> then call it on console:
>> /var/www/.../typo3/cli_dispatch.phpsh mycliscript -f hello
>>
>> works.
>
>
> Guys, you made my day!!!
>
> After searching half of the day for information about the CLI i found
> your thread with this easy but excellent example.
>
> Now i can start coding my scripts.
>
> Thanks a lot!
>
> regards
>
> Ansgar


--
Ingmar Schlecht
TYPO3 Association Active Member
_______________________________________________
TYPO3-dev mailing list
TYPO3-dev@...
http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-dev

Re: HowTo: Running a cronscript using TYPO3 with CLI

by Dmitry Dulepov [typo3] :: Rate this Message:

| View Threaded | Show Only this Message

Hi!

Ansgar Brauner wrote:
> Guys, you made my day!!!
>
> After searching half of the day for information about the CLI i found
> your thread with this easy but excellent example.

Good. Just make less quoting next time...

--
Dmitry Dulepov
TYPO3 core team
Web: http://typo3bloke.net/
Skype: callto:liels_bugs
"Nothing is impossible. There are only limits to our knowledge"
_______________________________________________
TYPO3-dev mailing list
TYPO3-dev@...
http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-dev
< Prev | 1 - 2 | Next >