Пример #1
1
 public function status()
 {
     return win32_query_service_status($this->serviceName);
 }
function testService($servicename, $computername)
{
    $test = win32_query_service_status($servicename, $computername);
    if ($test['CurrentState'] == 1) {
        $service_status = "<font color=FF0000>Stopped</font>";
    }
    if ($test['CurrentState'] == 4) {
        $service_status = "<font color=green>Running</font>";
    }
    echo $servicename;
    echo " ";
    echo $service_status;
}
function serviceStatus($servicename, $computername)
{
    $test = win32_query_service_status($servicename, $computername);
    if ($test["CurrentState"] == 1) {
        $service_status = "Stopped";
    }
    if ($test['CurrentState'] == 4) {
        $service_status = "Running";
    }
    if (!isset($test['CurrentState'])) {
        $service_status = "Access denied or RPC service is not running on the server";
    }
    echo "<p id='servicename'><strong>Service Name:</strong> {$servicename}</p>";
    echo "<p id='servicestatus'><strong>Service Status:</strong> {$service_status}</p>";
}
Пример #4
0
     $continue = false;
     $cnt = 0;
     while ($continue === false && $cnt < 15) {
         $result = win32_query_service_status($OOService);
         if (isset($result['ProcessId']) && $result['ProcessId'] != 0) {
             // If there is still a process id then the service has not stopped yet.
             sleep(2);
             $continue = false;
             $cnt++;
         } else {
             $continue = true;
         }
     }
 } else {
     // If this is vista, checking the port may not work so we query the service
     $result = win32_query_service_status($OOService);
     if (is_array($result)) {
         $iProcessId = $result['ProcessId'];
         if (!empty($iProcessId) && $iProcessId != 0) {
             // If there is a process id (PID) then open office is running so we exit
             if ($sGiveOutput) {
                 echo 1;
             }
             exit;
         }
     }
 }
 // Service is not running - log it and attempt to start
 $default->log->error('Check Open Office Task: Open office service is not running... trying to start it.');
 // Use the win32 service start
 $result2 = win32_start_service($OOService);
 * 
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License version 3 as published by the
 * Free Software Foundation.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, 
 * California 94120-7775, or email info@knowledgetree.com.
 * 
 * The interactive user interfaces in modified source and object code versions
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU General Public License version 3.
 * 
 * In accordance with Section 7(b) of the GNU General Public License version 3,
 * these Appropriate Legal Notices must retain the display of the "Powered by
 * KnowledgeTree" logo and retain the original copyright notice. If the display of the 
 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
 * must display the words "Powered by KnowledgeTree" and retain the original 
 * copyright notice.
 * Contributor( s): ______________________________________
 *
 */
var_dump(win32_query_service_status('ktscheduler'));
Пример #6
0
 function refresh_status()
 {
     $status = win32_query_service_status($this->name, $this->machine);
     if (is_array($status)) {
         $this->status = (object) $status;
         $this->last_error = WIN32_NO_ERROR;
         return true;
     }
     $this->status = null;
     $last_error = $status;
     return false;
 }
Пример #7
0
if (!file_exists($iniDir)) {
    die("Configuration file [{$iniDir}] not found.");
}
require_once __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'bootstrap_scheduler.php';
require_once __DIR__ . DIRECTORY_SEPARATOR . 'win-service-constants.php';
$serviceName = 'kaltura_batch';
//Windows Service Control
$serviceAction = 'status';
if (isset($argv) and isset($argv[1]) and strlen($argv[1])) {
    $serviceAction = $argv[1];
}
$systemConfig = parse_ini_file(realpath(__DIR__ . '\\..\\..\\configurations\\system.ini'));
$pid = $systemConfig['LOG_DIR'] . '\\batch\\batch.pid';
switch ($serviceAction) {
    case 'status':
        $ServiceStatus = win32_query_service_status($serviceName);
        if ($ServiceStatus['CurrentState'] == WIN32_SERVICE_STOPPED) {
            KalturaLog::info('Service Stopped');
        } else {
            if ($ServiceStatus['CurrentState'] == WIN32_SERVICE_START_PENDING) {
                KalturaLog::info('Service Start Pending');
            } else {
                if ($ServiceStatus['CurrentState'] == WIN32_SERVICE_STOP_PENDING) {
                    KalturaLog::info('Service Stop Pending');
                } else {
                    if ($ServiceStatus['CurrentState'] == WIN32_SERVICE_RUNNING) {
                        KalturaLog::info('Service Running');
                    } else {
                        if ($ServiceStatus['CurrentState'] == WIN32_SERVICE_CONTINUE_PENDING) {
                            KalturaLog::info('Service Continue Pending');
                        } else {