Commit 44a9996d0adedff5da0398b02ced11370392742e
1 parent
e7508b61
KTS-2525
"Create windows service to wrap around scheduler" Updated. issues on windows. Committed By: Conrad Vermeulen Reviewed By: Kevin Fourie git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@7523 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
2 changed files
with
16 additions
and
7 deletions
bin/scheduler.php
| ... | ... | @@ -175,10 +175,11 @@ if(!empty($aList)){ |
| 175 | 175 | $iStart = explode(' ', microtime()); |
| 176 | 176 | |
| 177 | 177 | // Run the script |
| 178 | - $file =escapeshellcmd($sTaskUrl); | |
| 178 | + $file = KT_DIR . $sTaskUrl; | |
| 179 | 179 | |
| 180 | 180 | $cmd = "\"$file\" {$sParameters}"; |
| 181 | 181 | |
| 182 | + $start = KTUtil::getBenchmarkTime(); | |
| 182 | 183 | if (OS_WINDOWS) |
| 183 | 184 | { |
| 184 | 185 | $cmd = str_replace( '/','\\',$cmd); |
| ... | ... | @@ -196,6 +197,11 @@ if(!empty($aList)){ |
| 196 | 197 | $default->log->info("Scheduler - Output: $res"); |
| 197 | 198 | $default->log->info("Scheduler - Background tasks should not produce output. Please review why this is producing output."); |
| 198 | 199 | } |
| 200 | + else | |
| 201 | + { | |
| 202 | + $time = number_format(KTUtil::getBenchmarkTime() - $start,2,'.',','); | |
| 203 | + $default->log->debug("Scheduler - Task: {$sTask} completed in {$diff}s."); | |
| 204 | + } | |
| 199 | 205 | |
| 200 | 206 | |
| 201 | 207 | // On completion - reset run time | ... | ... |
bin/win32/schedulerService.php
| ... | ... | @@ -12,7 +12,15 @@ global $default; |
| 12 | 12 | |
| 13 | 13 | $config = KTConfig::getSingleton(); |
| 14 | 14 | $schedulerInterval = $config->get('KnowledgeTree/schedulerInterval',10); // interval in seconds |
| 15 | -$phpPath = $config->get('externalBinary/php','php'); | |
| 15 | +//$phpPath = $config->get('externalBinary/php','php'); // TODO - fix me | |
| 16 | + | |
| 17 | +// Change to knowledgeTree/bin folder | |
| 18 | + | |
| 19 | +$dir = realpath(dirname(__FILE__) . '/..'); | |
| 20 | +chdir($dir); | |
| 21 | + | |
| 22 | +// Setup php binary path | |
| 23 | +$phpPath = realpath('../../php/php.exe'); | |
| 16 | 24 | |
| 17 | 25 | if (!is_file($phpPath)) |
| 18 | 26 | { |
| ... | ... | @@ -31,12 +39,7 @@ while (1) { |
| 31 | 39 | default: win32_set_service_status(WIN32_ERROR_CALL_NOT_IMPLEMENTED); // Add more cases to handle other service calls |
| 32 | 40 | } |
| 33 | 41 | |
| 34 | - // Change to knowledgeTree/bin folder | |
| 35 | - $dir = realpath(dirname(__FILE__) . '/..'); | |
| 36 | - chdir($dir); | |
| 37 | 42 | |
| 38 | - // Setup php binary path | |
| 39 | - $phpPath = realpath('../../php/php.exe'); | |
| 40 | 43 | |
| 41 | 44 | |
| 42 | 45 | // Run the scheduler script | ... | ... |