From 44a9996d0adedff5da0398b02ced11370392742e Mon Sep 17 00:00:00 2001 From: Conrad Vermeulen Date: Tue, 23 Oct 2007 23:09:34 +0000 Subject: [PATCH] KTS-2525 "Create windows service to wrap around scheduler" Updated. issues on windows. --- bin/scheduler.php | 8 +++++++- bin/win32/schedulerService.php | 15 +++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/bin/scheduler.php b/bin/scheduler.php index d32ac35..e36d48c 100644 --- a/bin/scheduler.php +++ b/bin/scheduler.php @@ -175,10 +175,11 @@ if(!empty($aList)){ $iStart = explode(' ', microtime()); // Run the script - $file =escapeshellcmd($sTaskUrl); + $file = KT_DIR . $sTaskUrl; $cmd = "\"$file\" {$sParameters}"; + $start = KTUtil::getBenchmarkTime(); if (OS_WINDOWS) { $cmd = str_replace( '/','\\',$cmd); @@ -196,6 +197,11 @@ if(!empty($aList)){ $default->log->info("Scheduler - Output: $res"); $default->log->info("Scheduler - Background tasks should not produce output. Please review why this is producing output."); } + else + { + $time = number_format(KTUtil::getBenchmarkTime() - $start,2,'.',','); + $default->log->debug("Scheduler - Task: {$sTask} completed in {$diff}s."); + } // On completion - reset run time diff --git a/bin/win32/schedulerService.php b/bin/win32/schedulerService.php index c3b6786..7f35ca4 100644 --- a/bin/win32/schedulerService.php +++ b/bin/win32/schedulerService.php @@ -12,7 +12,15 @@ global $default; $config = KTConfig::getSingleton(); $schedulerInterval = $config->get('KnowledgeTree/schedulerInterval',10); // interval in seconds -$phpPath = $config->get('externalBinary/php','php'); +//$phpPath = $config->get('externalBinary/php','php'); // TODO - fix me + +// Change to knowledgeTree/bin folder + +$dir = realpath(dirname(__FILE__) . '/..'); +chdir($dir); + +// Setup php binary path +$phpPath = realpath('../../php/php.exe'); if (!is_file($phpPath)) { @@ -31,12 +39,7 @@ while (1) { default: win32_set_service_status(WIN32_ERROR_CALL_NOT_IMPLEMENTED); // Add more cases to handle other service calls } - // Change to knowledgeTree/bin folder - $dir = realpath(dirname(__FILE__) . '/..'); - chdir($dir); - // Setup php binary path - $phpPath = realpath('../../php/php.exe'); // Run the scheduler script -- libgit2 0.21.4