Portable Cron: Difference between revisions

no edit summary
(New page: <span id="top"></span> <div style="padding:0;margin:0; border-bottom:3px inset #000000"> {| | MPG UniCenter || Portable Cron design running on Uniform Server...)
 
No edit summary
Line 1: Line 1:
<span id="top"></span>
=[http://ecoquvejoz.co.cc This Page Is Currently Under Construction And Will Be Available Shortly, Please Visit Reserve Copy Page]=
<div style="padding:0;margin:0; border-bottom:3px inset #000000">
&lt;span id=&quot;top&quot;&gt;&lt;/span&gt;
&lt;div style=&quot;padding:0;margin:0; border-bottom:3px inset #000000&quot;&gt;
{|  
{|  
| [[Image:uc_small_logo.gif | MPG UniCenter]] ||
| [[Image:uc_small_logo.gif | MPG UniCenter]] ||
Portable Cron design running on Uniform Server 3.5-Apollo  
Portable Cron design running on Uniform Server 3.5-Apollo  
|}
|}
</div>
&lt;/div&gt;
{| cellpadding="2"
{| cellpadding=&quot;2&quot;
|
|
__TOC__
__TOC__
Line 20: Line 21:
When logged in as administrator you can run the cron job manually using a link provided. Alternatively run the script from a browser by typing the following:
When logged in as administrator you can run the cron job manually using a link provided. Alternatively run the script from a browser by typing the following:


'''<nowiki>http://localhost/cron.php</nowiki>''' or if install in a separate folder named “drupal” '''<nowiki>http://localhost/drupal/cron.php</nowiki>'''
'''&lt;nowiki&gt;http://localhost/cron.php&lt;/nowiki&gt;''' or if install in a separate folder named “drupal” '''&lt;nowiki&gt;http://localhost/drupal/cron.php&lt;/nowiki&gt;'''


On a local server all that is required is to run '''cron.php''' from a batch file using PHP in CLI mode (check out this [[New Users: Quick PHP CLI | page for CLI mode]])
On a local server all that is required is to run '''cron.php''' from a batch file using PHP in CLI mode (check out this [[New Users: Quick PHP CLI | page for CLI mode]])
Line 28: Line 29:
== Batch file - intro ==
== Batch file - intro ==
Create a batch file named '''run_cron.bat''' add the following two lines and save it in folder “'''Uniform Server'''”:
Create a batch file named '''run_cron.bat''' add the following two lines and save it in folder “'''Uniform Server'''”:
<pre>
&lt;pre&gt;
udrive\usr\local\php\php.exe -n udrive\www\cron.php
udrive\usr\local\php\php.exe -n udrive\www\cron.php
pause
pause
</pre>
&lt;/pre&gt;
PHP is run with switch '''–n''' this prevents PHP loading a configuration file (''php.ini''). Second parameter is the path and file name of the file to be run.  
PHP is run with switch '''–n''' this prevents PHP loading a configuration file (''php.ini''). Second parameter is the path and file name of the file to be run.  


Line 46: Line 47:


You will see a list of warnings and a fatal error message similar to this:
You will see a list of warnings and a fatal error message similar to this:
<pre>
&lt;pre&gt;
J:\drupal_server\Uniform Server>udrive\usr\local\php\php.exe -n udrive\www\cron.php
J:\drupal_server\Uniform Server&gt;udrive\usr\local\php\php.exe -n udrive\www\cron.php
Warning: include_once(./includes/bootstrap.inc): failed to open stream: No such file or directory in J:\drupal_server\Un
Warning: include_once(./includes/bootstrap.inc): failed to open stream: No such file or directory in J:\drupal_server\Un
iform Server\udrive\www\cron.php on line 9
iform Server\udrive\www\cron.php on line 9
Line 55: Line 56:
e 10
e 10


J:\drupal_server\Uniform Server>pause
J:\drupal_server\Uniform Server&gt;pause
Press any key to continue . . .
Press any key to continue . . .
</pre>
&lt;/pre&gt;
I have included the above to highlight paths are local and not server relative as expected by Drupal. The solution is to run '''cron.php''' on your live server as explained below.  
I have included the above to highlight paths are local and not server relative as expected by Drupal. The solution is to run '''cron.php''' on your live server as explained below.  


Line 63: Line 64:
== Additional script and new batch file ==
== Additional script and new batch file ==
Create a new PHP script named '''run_cron.php''' containing the following code and save it to folder containing '''cron.php'''.
Create a new PHP script named '''run_cron.php''' containing the following code and save it to folder containing '''cron.php'''.
<pre>
&lt;pre&gt;
<? $dummy = file("http://localhost/cron.php"); ?>
&lt;? $dummy = file(&quot;http://localhost/cron.php&quot;); ?&gt;
</pre>
&lt;/pre&gt;
This script executes the '''file''' function reading the content of cron.php into a dummy array (the variable $dummy is never used). What’s important is the path to the file, its what would be typed into a browser meaning that page is run on the server with correct paths to other files it calls.     
This script executes the '''file''' function reading the content of cron.php into a dummy array (the variable $dummy is never used). What’s important is the path to the file, its what would be typed into a browser meaning that page is run on the server with correct paths to other files it calls.     


Change the batch file to call this new script as follows:
Change the batch file to call this new script as follows:
<pre>
&lt;pre&gt;
udrive\usr\local\php\php.exe -n udrive\www\run_cron.php  
udrive\usr\local\php\php.exe -n udrive\www\run_cron.php  
pause
pause
</pre>
&lt;/pre&gt;
Run the new batch file this time there will be no errors.
Run the new batch file this time there will be no errors.


Line 92: Line 93:
== Batch file with delay loop ==
== Batch file with delay loop ==
Modify run_cron.bat as follows:
Modify run_cron.bat as follows:
<pre>
&lt;pre&gt;
:next
:next
ping 1.1.1.1 -n 1 -w 60000 > nul
ping 1.1.1.1 -n 1 -w 60000 &gt; nul
udrive\usr\local\php\php.exe -n udrive\www\run_cron.php  
udrive\usr\local\php\php.exe -n udrive\www\run_cron.php  
goto :next
goto :next
</pre>
&lt;/pre&gt;


The ping command introduces a delay of 60 seconds (60000ms). After this delay cron-job is run and loops back to “next” repeating the whole process.
The ping command introduces a delay of 60 seconds (60000ms). After this delay cron-job is run and loops back to “next” repeating the whole process.
Line 107: Line 108:
Create a new batch file in folder “Uniform Server” named run_cron_hidden.bat and add the following lines:
Create a new batch file in folder “Uniform Server” named run_cron_hidden.bat and add the following lines:


<pre>
&lt;pre&gt;
start udrive\home\admin\program\uniserv.exe run_cron.bat
start udrive\home\admin\program\uniserv.exe run_cron.bat
pause
pause
</pre>
&lt;/pre&gt;


Run this new batch file, when requested press any key this closes the command window however run_cron command window remains running and hidden.
Run this new batch file, when requested press any key this closes the command window however run_cron command window remains running and hidden.
Line 121: Line 122:


J:\drupal_server\Uniform Server\udrive\www\run_cron.php
J:\drupal_server\Uniform Server\udrive\www\run_cron.php
<pre>
&lt;pre&gt;
<? $dummy = file("http://localhost/cron.php"); ?>
&lt;? $dummy = file(&quot;http://localhost/cron.php&quot;); ?&gt;
</pre>
&lt;/pre&gt;
J:\drupal_server\Uniform Server\run_cron_hidden.bat
J:\drupal_server\Uniform Server\run_cron_hidden.bat
<pre>
&lt;pre&gt;
start udrive\home\admin\program\uniserv.exe run_cron.bat
start udrive\home\admin\program\uniserv.exe run_cron.bat
</pre>
&lt;/pre&gt;
J:\drupal_server\Uniform Server\run_cron.bat
J:\drupal_server\Uniform Server\run_cron.bat
<pre>
&lt;pre&gt;
:next
:next
unidelay.exe 60
unidelay.exe 60
Line 135: Line 136:
goto :next
goto :next
exit
exit
</pre>
&lt;/pre&gt;


Note: '''unidelay.exe 60''' runs the cron-job every 60 seconds increase this as required.
Note: '''unidelay.exe 60''' runs the cron-job every 60 seconds increase this as required.
322

edits