[TYPO3-english] Scheduler: uptime instead of cron job?

Stephan Schuler Stephan.Schuler at netlogix.de
Wed Jan 11 23:20:10 CET 2012


Hey Dennis.


Most important thing first: You should not try to push something on a remote server directly but try to get things running on a local machine. This will make debugging a lot easier.

I'm thinking about what you're trying to do for several minutes now, but I still don't get it.

Do you just want to start the "scheduler" without having a cronjob? That's quite easy.
Or do you want to be able to run any TYPO3 cli by parameter or configuration in a nice way, speaking in terms of code quality, CGL and "the TYPO3 way"? Unfortunatelly that's way to big to be a result of such an uncoordinated discussion -- sry.

So: Just the easy part.

The cli_dispatcher is a script that starts any cli job. That does not necessarily have to be a recurring job like indexing or direct_mail bursts. Think about an import/export job, this can be CLI as well just as a one-time run.
And that's what its name is about: Dispatching your command line input.
The cli_dispatcher.phpsh takes the name of a unique cli command, initializes the CLI part of TYPO3 and runs the one cli command.

When the cli_dispatcher.phpsh is called, it can't know about your plan to run the TYPO3 scheduler by itself.
So: You have to tell the cli_dispatcher which cli command you want to run. You do that by using its unique cli key as the cli_dispatcher scripts first parameter.

Run: /var/www/something/typo3/cli_dispatcher.phpsh scheduler
The "scheduler" parameter is very important.

If you want to do this as a cronjob: Use the whole command as cron:
*/5 * * * * /var/www/something/typo3/cli_dispatcher.phps scheduler

If you want to have this done by a PHP script: Use the whole command as execution string:
exec('/var/www/something/typo3/cli_dispatcher.phps scheduler');

And that's it.


If you had a local TYPO3 environment, you could try this.
Starting the cli_dispatcher without any parameter tells you that you have to use a cli key.
Starting the cli_dispatcher with an invalid key tells you the key to be invalid and names you a list of valid keys.
Starting the cli_dispatcher with a valid key but without having the proper cli be_uer created tells you exactly that.

So: Just set up your local TYPO3 environment and try. This will definitely make your understanding much clearer then digging the source of cli_dispatcher.phps makes.


Sorry if this mail sounds a bit harsh, it's realy not inteded to. I just think you stumbled over some tiny things but didn't realize them to be important. So I just namend everything I think you missed.


Regards,


Stephan Schuler
Web-Entwickler

Telefon: +49 (911) 539909 - 0
E-Mail: Stephan.Schuler at netlogix.de
Website: media.netlogix.de


--
netlogix GmbH & Co. KG
IT-Services | IT-Training | Media
Andernacher Stra?e 53 | 90411 N?rnberg
Telefon: +49 (911) 539909 - 0 | Fax: +49 (911) 539909 - 99
E-Mail: info at netlogix.de | Internet: http://www.netlogix.de

netlogix GmbH & Co. KG ist eingetragen am Amtsgericht N?rnberg (HRA 13338)
Pers?nlich haftende Gesellschafterin: netlogix Verwaltungs GmbH (HRB 20634)
Umsatzsteuer-Identifikationsnummer: DE 233472254
Gesch?ftsf?hrer: Stefan Buchta, Matthias Schmidt



________________________________________
Von: typo3-english-bounces at lists.typo3.org [typo3-english-bounces at lists.typo3.org]" im Auftrag von "Dennis Hoffland [d.o.hoffland at tele2.nl]
Gesendet: Mittwoch, 11. Januar 2012 20:59
Bis: typo3-english at lists.typo3.org
Betreff: Re: [TYPO3-english] Scheduler: uptime instead of cron job?

Hi Xavier,



I did some further digging, taking a closer view of cli_dispatch.phpsh.



If I use /var/www/g12345/mydomain.com/HTML/typo3/cli_dispatch.phpsh as my
path for passthru () (= option 1 in my previous mail, which I believe to be
the correct path) I get the following error: The first argument must be a
valid key. (See line 107 of cli_dispatch.phpsh).



To see what is actually happening I made a copy of cli_dispatch.phpsh,
renamed it to test_args.php, put it in typo3/.



Everything after line 105 I have replaced by:



                // Define absolute path to this script

define('PATH_thisScript',$temp_PATH_thisScript);



echo 'PATH_thisScript: ' . PATH_thisScript . "\n";



                // First argument is a key that points to the script
configuration

define('TYPO3_cliKey', $_SERVER['argv'][1]);



echo 'TYPO3_cliKey: ' . TYPO3_cliKey . "\n";



echo 'init.php path: ' . dirname(PATH_thisScript).'/init.php' . "\n";



echo "Test Arguments:\n";

echo 'argc:'. $_SERVER["argc"]."\n";

echo 'argv 0: '. $_SERVER["argv"][0] . "\n";

echo 'argv 1: '. $_SERVER["argv"][1] . "\n";

?>



As output I get:



PATH_thisScript: /var/www/g12345/mydomain.com/HTML/typo3/testargs.php



TYPO3_cliKey:

init.php path: /var/www/g12345/mydomain.com/HTML/typo3/init.php

Test Arguments:

argc:1

argv 0: /var/www/g12345/mydomain.com/HTML/typo3/hbs_testargs.php

argv 1:



It clearly demonstrates that $_SERVER["argv"][1] is empty (which would
indeed trigger the error at line 107) and also leaves TYPO3_cliKey
undefined.



Everything else looks normal to me.



Your thoughts on this?



Kind regards,



Dennis





_______________________________________________
TYPO3-english mailing list
TYPO3-english at lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english


More information about the TYPO3-english mailing list