2024.8.23
Loading...
Searching...
No Matches
Nssm Class Reference

Public Member Functions

 __construct ($name)
 
 create ()
 
 delete ()
 
 getBinPath ()
 
 getDisplayName ()
 
 getEnvironmentExtra ()
 
 getError ()
 
 getLatestError ()
 
 getLatestStatus ()
 
 getName ()
 
 getParams ()
 
 getStart ()
 
 getStderr ()
 
 getStdout ()
 
 infos ()
 
 isInstalled ()
 
 isPaused ()
 
 isPending ($status)
 
 isRunning ()
 
 isStopped ()
 
 restart ()
 
 setBinPath ($binPath)
 
 setDisplayName ($displayName)
 
 setEnvironmentExtra ($environmentExtra)
 
 setName ($name)
 
 setParams ($params)
 
 setStart ($start)
 
 setStderr ($stderr)
 
 setStdout ($stdout)
 
 start ()
 
 status ($timeout=true)
 
 stop ()
 

Data Fields

const INFO_APP_DIRECTORY = 'AppDirectory'
 
const INFO_APP_ENVIRONMENT_EXTRA = 'AppEnvironmentExtra'
 
const INFO_APP_PARAMETERS = 'AppParameters'
 
const INFO_APP_STDERR = 'AppStderr'
 
const INFO_APP_STDOUT = 'AppStdout'
 
const INFO_APPLICATION = 'Application'
 
const PENDING_TIMEOUT = 10
 
const SERVICE_AUTO_START = 'SERVICE_AUTO_START'
 
const SERVICE_DELAYED_START = 'SERVICE_DELAYED_START'
 
const SERVICE_DEMAND_START = 'SERVICE_DEMAND_START'
 
const SERVICE_DISABLED = 'SERVICE_DISABLED'
 
const SERVICE_INTERACTIVE_PROCESS = 'SERVICE_INTERACTIVE_PROCESS'
 
const SERVICE_WIN32_OWN_PROCESS = 'SERVICE_WIN32_OWN_PROCESS'
 
const SLEEP_TIME = 500000
 
const STATUS_CONTINUE_PENDING = 'SERVICE_CONTINUE_PENDING'
 
const STATUS_NA = '-1'
 
const STATUS_NOT_EXIST = 'SERVICE_NOT_EXIST'
 
const STATUS_PAUSE_PENDING = 'SERVICE_PAUSE_PENDING'
 
const STATUS_PAUSED = 'SERVICE_PAUSED'
 
const STATUS_RUNNING = 'SERVICE_RUNNING'
 
const STATUS_START_PENDING = 'SERVICE_START_PENDING'
 
const STATUS_STOP_PENDING = 'SERVICE_STOP_PENDING'
 
const STATUS_STOPPED = 'SERVICE_STOPPED'
 

Private Member Functions

 exec ($args)
 
 getServiceStatusDesc ($status)
 
 writeLog ($log)
 
 writeLogError ($log)
 
 writeLogInfo ($log)
 

Private Attributes

 $binPath
 
 $displayName
 
 $environmentExtra
 
 $latestError
 
 $latestStatus
 
 $name
 
 $params
 
 $start
 
 $stderr
 
 $stdout
 

Detailed Description

Class Nssm

This class provides methods to manage Windows services using NSSM (Non-Sucking Service Manager). It includes functionalities to create, delete, start, stop, and retrieve the status of services. The class also logs operations and errors.

Definition at line 17 of file class.nssm.php.

Constructor & Destructor Documentation

◆ __construct()

Nssm::__construct ( $name)

Nssm constructor. Initializes the Nssm class and logs the initialization.

Parameters
string$nameThe name of the service.

Definition at line 68 of file class.nssm.php.

69 {
70 Util::logInitClass( $this );
71 $this->name = $name;
72 }
static logInitClass($classInstance)

References $name, and Util\logInitClass().

Member Function Documentation

◆ create()

Nssm::create ( )

Creates a new service.

Returns
bool True if the service was created successfully, false otherwise.

Definition at line 183 of file class.nssm.php.

184 {
185 $this->writeLog( 'Create service' );
186 $this->writeLog( '-> service: ' . $this->getName() );
187 $this->writeLog( '-> display: ' . $this->getDisplayName() );
188 $this->writeLog( '-> description: ' . $this->getDisplayName() );
189 $this->writeLog( '-> path: ' . $this->getBinPath() );
190 $this->writeLog( '-> params: ' . $this->getParams() );
191 $this->writeLog( '-> stdout: ' . $this->getStdout() );
192 $this->writeLog( '-> stderr: ' . $this->getStderr() );
193 $this->writeLog( '-> environment extra: ' . $this->getEnvironmentExtra() );
194 $this->writeLog( '-> start_type: ' . ($this->getStart() != null ? $this->getStart() : self::SERVICE_DEMAND_START) );
195
196 // Install bin
197 $exec = $this->exec( 'install ' . $this->getName() . ' "' . $this->getBinPath() . '"' );
198 if ( $exec === false ) {
199 return false;
200 }
201
202 // Params
203 $exec = $this->exec( 'set ' . $this->getName() . ' AppParameters "' . $this->getParams() . '"' );
204 if ( $exec === false ) {
205 return false;
206 }
207
208 // DisplayName
209 $exec = $this->exec( 'set ' . $this->getName() . ' DisplayName "' . $this->getDisplayName() . '"' );
210 if ( $exec === false ) {
211 return false;
212 }
213
214 // Description
215 $exec = $this->exec( 'set ' . $this->getName() . ' Description "' . $this->getDisplayName() . '"' );
216 if ( $exec === false ) {
217 return false;
218 }
219
220 // No AppNoConsole to fix nssm problems with Windows 10 Creators update.
221 $exec = $this->exec( 'set ' . $this->getName() . ' AppNoConsole "1"' );
222 if ( $exec === false ) {
223 return false;
224 }
225
226 // Start
227 $exec = $this->exec( 'set ' . $this->getName() . ' Start "' . ($this->getStart() != null ? $this->getStart() : self::SERVICE_DEMAND_START) . '"' );
228 if ( $exec === false ) {
229 return false;
230 }
231
232 // Stdout
233 $exec = $this->exec( 'set ' . $this->getName() . ' AppStdout "' . $this->getStdout() . '"' );
234 if ( $exec === false ) {
235 return false;
236 }
237
238 // Stderr
239 $exec = $this->exec( 'set ' . $this->getName() . ' AppStderr "' . $this->getStderr() . '"' );
240 if ( $exec === false ) {
241 return false;
242 }
243
244 // Environment Extra
245 $exec = $this->exec( 'set ' . $this->getName() . ' AppEnvironmentExtra ' . $this->getEnvironmentExtra() );
246 if ( $exec === false ) {
247 return false;
248 }
249
250 if ( !$this->isInstalled() ) {
251 $this->latestError = null;
252
253 return false;
254 }
255
256 return true;
257 }
getBinPath()
getDisplayName()
exec($args)
getEnvironmentExtra()
const SERVICE_DEMAND_START
getParams()
writeLog($log)
getName()
getStart()
isInstalled()
getStderr()
getStdout()

References exec(), getBinPath(), getDisplayName(), getEnvironmentExtra(), getName(), getParams(), getStart(), getStderr(), getStdout(), isInstalled(), SERVICE_DEMAND_START, and writeLog().

◆ delete()

Nssm::delete ( )

Deletes the service.

Returns
bool True if the service was deleted successfully, false otherwise.

Definition at line 264 of file class.nssm.php.

265 {
266 $this->stop();
267
268 $this->writeLog( 'Delete service ' . $this->getName() );
269 $exec = $this->exec( 'remove ' . $this->getName() . ' confirm' );
270 if ( $exec === false ) {
271 return false;
272 }
273
274 if ( $this->isInstalled() ) {
275 $this->latestError = null;
276
277 return false;
278 }
279
280 return true;
281 }

References exec(), getName(), isInstalled(), stop(), and writeLog().

◆ exec()

Nssm::exec ( $args)
private

Executes an NSSM command.

Parameters
string$argsThe arguments for the NSSM command.
Returns
array|false The result of the execution, or false on failure.

Definition at line 114 of file class.nssm.php.

115 {
116 global $bearsamppCore;
117
118 $command = '"' . $bearsamppCore->getNssmExe() . '" ' . $args;
119 $this->writeLogInfo( 'Cmd: ' . $command );
120
121 $result = Batch::exec( 'nssm', $command, 10 );
122 if ( is_array( $result ) ) {
123 $rebuildResult = array();
124 foreach ( $result as $row ) {
125 $row = trim( $row );
126 if ( !empty( $row ) ) {
127 $rebuildResult[] = preg_replace( '/[\x00-\x1F\x80-\xFF]/', '', $row );
128 }
129 }
130 $result = $rebuildResult;
131 if ( count( $result ) > 1 ) {
132 $this->latestError = implode( ' ; ', $result );
133 }
134
135 return $result;
136 }
137
138 return false;
139 }
$result
global $bearsamppCore
static exec($basename, $content, $timeout=true, $catchOutput=true, $standalone=false, $silent=true, $rebuild=true)
writeLogInfo($log)

References $bearsamppCore, $result, Batch\exec(), and writeLogInfo().

Referenced by create(), delete(), start(), status(), and stop().

+ Here is the caller graph for this function:

◆ getBinPath()

Nssm::getBinPath ( )

Gets the binary path of the service.

Returns
string The binary path of the service.

Definition at line 538 of file class.nssm.php.

539 {
540 return $this->binPath;
541 }

References $binPath.

Referenced by create().

+ Here is the caller graph for this function:

◆ getDisplayName()

Nssm::getDisplayName ( )

Gets the display name of the service.

Returns
string The display name of the service.

Definition at line 518 of file class.nssm.php.

519 {
520 return $this->displayName;
521 }
$displayName

References $displayName.

Referenced by create().

+ Here is the caller graph for this function:

◆ getEnvironmentExtra()

Nssm::getEnvironmentExtra ( )

Gets the additional environment variables for the service.

Returns
string The additional environment variables.

Definition at line 638 of file class.nssm.php.

639 {
641 }
$environmentExtra

References $environmentExtra.

Referenced by create().

+ Here is the caller graph for this function:

◆ getError()

Nssm::getError ( )

Retrieves the error message or status description of the service.

Returns
string|null The error message or status description, or null if no error or status is available.

Definition at line 678 of file class.nssm.php.

679 {
680 global $bearsamppLang;
681
682 if ( !empty( $this->latestError ) ) {
683 return $bearsamppLang->getValue( Lang::ERROR ) . ' ' . $this->latestError;
684 }
685 elseif ( $this->latestStatus != self::STATUS_NA ) {
686 return $bearsamppLang->getValue( Lang::STATUS ) . ' ' . $this->latestStatus . ' : ' . $this->getWin32ServiceStatusDesc( $this->latestStatus );
687 }
688
689 return null;
690 }
global $bearsamppLang
const ERROR
const STATUS
$latestError

References $bearsamppLang, $latestError, Lang\ERROR, and Lang\STATUS.

◆ getLatestError()

Nssm::getLatestError ( )

Gets the latest error message related to the service.

Returns
string The latest error message.

Definition at line 668 of file class.nssm.php.

669 {
670 return $this->latestError;
671 }

References $latestError.

◆ getLatestStatus()

Nssm::getLatestStatus ( )

Gets the latest status of the service.

Returns
string The latest status of the service.

Definition at line 658 of file class.nssm.php.

659 {
660 return $this->latestStatus;
661 }
$latestStatus

References $latestStatus.

◆ getName()

Nssm::getName ( )

Gets the name of the service.

Returns
string The name of the service.

Definition at line 498 of file class.nssm.php.

499 {
500 return $this->name;
501 }

References $name.

Referenced by create(), delete(), infos(), isInstalled(), isPaused(), isRunning(), isStopped(), start(), status(), and stop().

+ Here is the caller graph for this function:

◆ getParams()

Nssm::getParams ( )

Gets the parameters of the service.

Returns
string The parameters of the service.

Definition at line 558 of file class.nssm.php.

559 {
560 return $this->params;
561 }

References $params.

Referenced by create().

+ Here is the caller graph for this function:

◆ getServiceStatusDesc()

Nssm::getServiceStatusDesc ( $status)
private

Retrieves the description of the service status.

Parameters
string$statusThe status to describe.
Returns
string|null The description of the status, or null if not recognized.

Definition at line 461 of file class.nssm.php.

462 {
463 switch ( $status ) {
465 return 'The service continue is pending.';
466
468 return 'The service pause is pending.';
469
471 return 'The service is paused.';
472
474 return 'The service is running.';
475
477 return 'The service is starting.';
478
480 return 'The service is stopping.';
481
483 return 'The service is not running.';
484
485 case self::STATUS_NA:
486 return 'Cannot retrieve service status.';
487
488 default:
489 return null;
490 }
491 }
const STATUS_NA
const STATUS_STOPPED
const STATUS_RUNNING
const STATUS_START_PENDING
const STATUS_CONTINUE_PENDING
const STATUS_PAUSED
const STATUS_PAUSE_PENDING
const STATUS_STOP_PENDING

References STATUS_CONTINUE_PENDING, STATUS_NA, STATUS_PAUSE_PENDING, STATUS_PAUSED, STATUS_RUNNING, STATUS_START_PENDING, STATUS_STOP_PENDING, and STATUS_STOPPED.

◆ getStart()

Nssm::getStart ( )

Gets the start type of the service.

Returns
string The start type of the service.

Definition at line 578 of file class.nssm.php.

579 {
580 return $this->start;
581 }

References $start.

Referenced by create().

+ Here is the caller graph for this function:

◆ getStderr()

Nssm::getStderr ( )

Gets the stderr path of the service.

Returns
string The stderr path of the service.

Definition at line 618 of file class.nssm.php.

619 {
620 return $this->stderr;
621 }

References $stderr.

Referenced by create().

+ Here is the caller graph for this function:

◆ getStdout()

Nssm::getStdout ( )

Gets the stdout path of the service.

Returns
string The stdout path of the service.

Definition at line 598 of file class.nssm.php.

599 {
600 return $this->stdout;
601 }

References $stdout.

Referenced by create().

+ Here is the caller graph for this function:

◆ infos()

Nssm::infos ( )

Retrieves information about the service.

Returns
array|false The service information, or false on failure.

Definition at line 348 of file class.nssm.php.

349 {
350 global $bearsamppRegistry;
351
352 $infos = Vbs::getServiceInfos( $this->getName() );
353 if ( $infos === false ) {
354 return false;
355 }
356
357 $infosNssm = array();
358 $infosKeys = array(
359 self::INFO_APPLICATION,
360 self::INFO_APP_PARAMETERS,
361 );
362
363 foreach ( $infosKeys as $infoKey ) {
364 $value = null;
365 $exists = $bearsamppRegistry->exists(
367 'SYSTEM\CurrentControlSet\Services\\' . $this->getName() . '\Parameters',
368 $infoKey
369 );
370 if ( $exists ) {
371 $value = $bearsamppRegistry->getValue(
373 'SYSTEM\CurrentControlSet\Services\\' . $this->getName() . '\Parameters',
374 $infoKey
375 );
376 }
377 $infosNssm[$infoKey] = $value;
378 }
379
380 if ( !isset( $infosNssm[self::INFO_APPLICATION] ) ) {
381 return $infos;
382 }
383
384 $infos[Win32Service::VBS_PATH_NAME] = $infosNssm[Nssm::INFO_APPLICATION] . ' ' . $infosNssm[Nssm::INFO_APP_PARAMETERS];
385
386 return $infos;
387 }
const INFO_APP_PARAMETERS
const INFO_APPLICATION
const HKEY_LOCAL_MACHINE
static getServiceInfos($serviceName)

References getName(), Vbs\getServiceInfos(), Registry\HKEY_LOCAL_MACHINE, INFO_APP_PARAMETERS, INFO_APPLICATION, and Win32Service\VBS_PATH_NAME.

◆ isInstalled()

Nssm::isInstalled ( )

Checks if the service is installed.

Returns
bool True if the service is installed, false otherwise.

Definition at line 394 of file class.nssm.php.

395 {
396 $status = $this->status();
397 $this->writeLog( 'isInstalled ' . $this->getName() . ': ' . ($status != self::STATUS_NA ? 'YES' : 'NO') . ' (status: ' . $status . ')' );
398
399 return $status != self::STATUS_NA;
400 }
status($timeout=true)

References getName(), status(), STATUS_NA, and writeLog().

Referenced by create(), and delete().

+ Here is the caller graph for this function:

◆ isPaused()

Nssm::isPaused ( )

Checks if the service is paused.

Returns
bool True if the service is paused, false otherwise.

Definition at line 433 of file class.nssm.php.

434 {
435 $status = $this->status();
436 $this->writeLog( 'isPaused ' . $this->getName() . ': ' . ($status == self::STATUS_PAUSED ? 'YES' : 'NO') . ' (status: ' . $status . ')' );
437
438 return $status == self::STATUS_PAUSED;
439 }

References getName(), status(), STATUS_PAUSED, and writeLog().

◆ isPending()

Nssm::isPending ( $status)

Checks if the service status is pending.

Parameters
string$statusThe status to check.
Returns
bool True if the status is pending, false otherwise.

Definition at line 448 of file class.nssm.php.

449 {
450 return $status == self::STATUS_START_PENDING || $status == self::STATUS_STOP_PENDING
451 || $status == self::STATUS_CONTINUE_PENDING || $status == self::STATUS_PAUSE_PENDING;
452 }

References STATUS_PAUSE_PENDING.

Referenced by status().

+ Here is the caller graph for this function:

◆ isRunning()

Nssm::isRunning ( )

Checks if the service is running.

Returns
bool True if the service is running, false otherwise.

Definition at line 407 of file class.nssm.php.

408 {
409 $status = $this->status();
410 $this->writeLog( 'isRunning ' . $this->getName() . ': ' . ($status == self::STATUS_RUNNING ? 'YES' : 'NO') . ' (status: ' . $status . ')' );
411
412 return $status == self::STATUS_RUNNING;
413 }

References getName(), status(), STATUS_RUNNING, and writeLog().

Referenced by start().

+ Here is the caller graph for this function:

◆ isStopped()

Nssm::isStopped ( )

Checks if the service is stopped.

Returns
bool True if the service is stopped, false otherwise.

Definition at line 420 of file class.nssm.php.

421 {
422 $status = $this->status();
423 $this->writeLog( 'isStopped ' . $this->getName() . ': ' . ($status == self::STATUS_STOPPED ? 'YES' : 'NO') . ' (status: ' . $status . ')' );
424
425 return $status == self::STATUS_STOPPED;
426 }

References getName(), status(), STATUS_STOPPED, and writeLog().

Referenced by stop().

+ Here is the caller graph for this function:

◆ restart()

Nssm::restart ( )

Restarts the service.

Returns
bool True if the service was restarted successfully, false otherwise.

Definition at line 334 of file class.nssm.php.

335 {
336 if ( $this->stop() ) {
337 return $this->start();
338 }
339
340 return false;
341 }

References start(), and stop().

◆ setBinPath()

Nssm::setBinPath ( $binPath)

Sets the binary path of the service.

Parameters
string$binPathThe binary path to set.

Definition at line 548 of file class.nssm.php.

549 {
550 $this->binPath = str_replace( '"', '', Util::formatWindowsPath( $binPath ) );
551 }
static formatWindowsPath($path)

References $binPath, and Util\formatWindowsPath().

◆ setDisplayName()

Nssm::setDisplayName ( $displayName)

Sets the display name of the service.

Parameters
string$displayNameThe display name to set.

Definition at line 528 of file class.nssm.php.

529 {
530 $this->displayName = $displayName;
531 }

References $displayName.

◆ setEnvironmentExtra()

Nssm::setEnvironmentExtra ( $environmentExtra)

Sets the additional environment variables for the service.

Parameters
string$environmentExtraThe additional environment variables to set.

Definition at line 648 of file class.nssm.php.

649 {
650 $this->environmentExtra = Util::formatWindowsPath( $environmentExtra );
651 }

References $environmentExtra, and Util\formatWindowsPath().

◆ setName()

Nssm::setName ( $name)

Sets the name of the service.

Parameters
string$nameThe name to set.

Definition at line 508 of file class.nssm.php.

509 {
510 $this->name = $name;
511 }

References $name.

◆ setParams()

Nssm::setParams ( $params)

Sets the parameters of the service.

Parameters
string$paramsThe parameters to set.

Definition at line 568 of file class.nssm.php.

569 {
570 $this->params = $params;
571 }

References $params.

◆ setStart()

Nssm::setStart ( $start)

Sets the start type of the service.

Parameters
string$startThe start type to set.

Definition at line 588 of file class.nssm.php.

589 {
590 $this->start = $start;
591 }

References $start, and start().

◆ setStderr()

Nssm::setStderr ( $stderr)

Sets the stderr path of the service.

Parameters
string$stderrThe stderr path to set.

Definition at line 628 of file class.nssm.php.

629 {
630 $this->stderr = $stderr;
631 }

References $stderr.

◆ setStdout()

Nssm::setStdout ( $stdout)

Sets the stdout path of the service.

Parameters
string$stdoutThe stdout path to set.

Definition at line 608 of file class.nssm.php.

609 {
610 $this->stdout = $stdout;
611 }

References $stdout.

◆ start()

Nssm::start ( )

Starts the service.

Returns
bool True if the service was started successfully, false otherwise.

Definition at line 288 of file class.nssm.php.

289 {
290 $this->writeLog( 'Start service ' . $this->getName() );
291
292 $exec = $this->exec( 'start ' . $this->getName() );
293 if ( $exec === false ) {
294 return false;
295 }
296
297 if ( !$this->isRunning() ) {
298 $this->latestError = null;
299
300 return false;
301 }
302
303 return true;
304 }
isRunning()

References exec(), getName(), isRunning(), and writeLog().

Referenced by restart(), and setStart().

+ Here is the caller graph for this function:

◆ status()

Nssm::status ( $timeout = true)

Retrieves the status of the service.

Parameters
bool$timeoutWhether to apply a timeout for the status check.
Returns
string The status of the service.

Definition at line 148 of file class.nssm.php.

149 {
150 usleep( self::SLEEP_TIME );
151
152 $this->latestStatus = self::STATUS_NA;
153 $maxtime = time() + self::PENDING_TIMEOUT;
154
155 while ( $this->latestStatus == self::STATUS_NA || $this->isPending( $this->latestStatus ) ) {
156 $exec = $this->exec( 'status ' . $this->getName() );
157 if ( $exec !== false ) {
158 if ( count( $exec ) > 1 ) {
159 $this->latestStatus = self::STATUS_NOT_EXIST;
160 }
161 else {
162 $this->latestStatus = $exec[0];
163 }
164 }
165 if ( $timeout && $maxtime < time() ) {
166 break;
167 }
168 }
169
170 if ( $this->latestStatus == self::STATUS_NOT_EXIST ) {
171 $this->latestError = 'Error 3: The specified service does not exist as an installed service.';
172 $this->latestStatus = self::STATUS_NA;
173 }
174
175 return $this->latestStatus;
176 }
const PENDING_TIMEOUT
isPending($status)
const STATUS_NOT_EXIST

References $latestStatus, exec(), getName(), isPending(), PENDING_TIMEOUT, STATUS_NA, and STATUS_NOT_EXIST.

Referenced by isInstalled(), isPaused(), isRunning(), and isStopped().

+ Here is the caller graph for this function:

◆ stop()

Nssm::stop ( )

Stops the service.

Returns
bool True if the service was stopped successfully, false otherwise.

Definition at line 311 of file class.nssm.php.

312 {
313 $this->writeLog( 'Stop service ' . $this->getName() );
314
315 $exec = $this->exec( 'stop ' . $this->getName() );
316 if ( $exec === false ) {
317 return false;
318 }
319
320 if ( !$this->isStopped() ) {
321 $this->latestError = null;
322
323 return false;
324 }
325
326 return true;
327 }
isStopped()

References exec(), getName(), isStopped(), and writeLog().

Referenced by delete(), and restart().

+ Here is the caller graph for this function:

◆ writeLog()

Nssm::writeLog ( $log)
private

Writes a log entry.

Parameters
string$logThe log message to write.

Definition at line 79 of file class.nssm.php.

80 {
81 global $bearsamppRoot;
82 Util::logDebug( $log, $bearsamppRoot->getNssmLogFilePath() );
83 }
global $bearsamppRoot
static logDebug($data, $file=null)

References $bearsamppRoot, and Util\logDebug().

Referenced by create(), delete(), isInstalled(), isPaused(), isRunning(), isStopped(), start(), and stop().

+ Here is the caller graph for this function:

◆ writeLogError()

Nssm::writeLogError ( $log)
private

Writes an error log entry.

Parameters
string$logThe log message to write.

Definition at line 101 of file class.nssm.php.

102 {
103 global $bearsamppRoot;
104 Util::logError( $log, $bearsamppRoot->getNssmLogFilePath() );
105 }
static logError($data, $file=null)

References $bearsamppRoot, and Util\logError().

◆ writeLogInfo()

Nssm::writeLogInfo ( $log)
private

Writes an informational log entry.

Parameters
string$logThe log message to write.

Definition at line 90 of file class.nssm.php.

91 {
92 global $bearsamppRoot;
93 Util::logInfo( $log, $bearsamppRoot->getNssmLogFilePath() );
94 }
static logInfo($data, $file=null)

References $bearsamppRoot, and Util\logInfo().

Referenced by exec().

+ Here is the caller graph for this function:

Field Documentation

◆ $binPath

Nssm::$binPath
private

Definition at line 53 of file class.nssm.php.

Referenced by getBinPath(), and setBinPath().

◆ $displayName

Nssm::$displayName
private

Definition at line 52 of file class.nssm.php.

Referenced by getDisplayName(), and setDisplayName().

◆ $environmentExtra

Nssm::$environmentExtra
private

Definition at line 58 of file class.nssm.php.

Referenced by getEnvironmentExtra(), and setEnvironmentExtra().

◆ $latestError

Nssm::$latestError
private

Definition at line 59 of file class.nssm.php.

Referenced by getError(), and getLatestError().

◆ $latestStatus

Nssm::$latestStatus
private

Definition at line 60 of file class.nssm.php.

Referenced by getLatestStatus(), and status().

◆ $name

Nssm::$name
private

Definition at line 51 of file class.nssm.php.

Referenced by __construct(), getName(), and setName().

◆ $params

Nssm::$params
private

Definition at line 54 of file class.nssm.php.

Referenced by getParams(), and setParams().

◆ $start

Nssm::$start
private

Definition at line 55 of file class.nssm.php.

Referenced by getStart(), and setStart().

◆ $stderr

Nssm::$stderr
private

Definition at line 57 of file class.nssm.php.

Referenced by getStderr(), and setStderr().

◆ $stdout

Nssm::$stdout
private

Definition at line 56 of file class.nssm.php.

Referenced by getStdout(), and setStdout().

◆ INFO_APP_DIRECTORY

const Nssm::INFO_APP_DIRECTORY = 'AppDirectory'

Definition at line 41 of file class.nssm.php.

◆ INFO_APP_ENVIRONMENT_EXTRA

const Nssm::INFO_APP_ENVIRONMENT_EXTRA = 'AppEnvironmentExtra'

Definition at line 46 of file class.nssm.php.

◆ INFO_APP_PARAMETERS

const Nssm::INFO_APP_PARAMETERS = 'AppParameters'

◆ INFO_APP_STDERR

const Nssm::INFO_APP_STDERR = 'AppStderr'

Definition at line 44 of file class.nssm.php.

◆ INFO_APP_STDOUT

const Nssm::INFO_APP_STDOUT = 'AppStdout'

Definition at line 45 of file class.nssm.php.

◆ INFO_APPLICATION

const Nssm::INFO_APPLICATION = 'Application'

Definition at line 42 of file class.nssm.php.

Referenced by infos().

◆ PENDING_TIMEOUT

const Nssm::PENDING_TIMEOUT = 10

Definition at line 48 of file class.nssm.php.

Referenced by status().

◆ SERVICE_AUTO_START

const Nssm::SERVICE_AUTO_START = 'SERVICE_AUTO_START'

Definition at line 20 of file class.nssm.php.

◆ SERVICE_DELAYED_START

const Nssm::SERVICE_DELAYED_START = 'SERVICE_DELAYED_START'

Definition at line 21 of file class.nssm.php.

◆ SERVICE_DEMAND_START

const Nssm::SERVICE_DEMAND_START = 'SERVICE_DEMAND_START'

◆ SERVICE_DISABLED

const Nssm::SERVICE_DISABLED = 'SERVICE_DISABLED'

Definition at line 23 of file class.nssm.php.

◆ SERVICE_INTERACTIVE_PROCESS

const Nssm::SERVICE_INTERACTIVE_PROCESS = 'SERVICE_INTERACTIVE_PROCESS'

Definition at line 27 of file class.nssm.php.

◆ SERVICE_WIN32_OWN_PROCESS

const Nssm::SERVICE_WIN32_OWN_PROCESS = 'SERVICE_WIN32_OWN_PROCESS'

Definition at line 26 of file class.nssm.php.

◆ SLEEP_TIME

const Nssm::SLEEP_TIME = 500000

Definition at line 49 of file class.nssm.php.

◆ STATUS_CONTINUE_PENDING

const Nssm::STATUS_CONTINUE_PENDING = 'SERVICE_CONTINUE_PENDING'

Definition at line 30 of file class.nssm.php.

Referenced by getServiceStatusDesc().

◆ STATUS_NA

const Nssm::STATUS_NA = '-1'

Definition at line 38 of file class.nssm.php.

Referenced by getServiceStatusDesc(), isInstalled(), and status().

◆ STATUS_NOT_EXIST

const Nssm::STATUS_NOT_EXIST = 'SERVICE_NOT_EXIST'

Definition at line 37 of file class.nssm.php.

Referenced by status().

◆ STATUS_PAUSE_PENDING

const Nssm::STATUS_PAUSE_PENDING = 'SERVICE_PAUSE_PENDING'

Definition at line 31 of file class.nssm.php.

Referenced by getServiceStatusDesc(), and isPending().

◆ STATUS_PAUSED

const Nssm::STATUS_PAUSED = 'SERVICE_PAUSED'

Definition at line 32 of file class.nssm.php.

Referenced by getServiceStatusDesc(), and isPaused().

◆ STATUS_RUNNING

const Nssm::STATUS_RUNNING = 'SERVICE_RUNNING'

Definition at line 33 of file class.nssm.php.

Referenced by getServiceStatusDesc(), and isRunning().

◆ STATUS_START_PENDING

const Nssm::STATUS_START_PENDING = 'SERVICE_START_PENDING'

Definition at line 34 of file class.nssm.php.

Referenced by getServiceStatusDesc().

◆ STATUS_STOP_PENDING

const Nssm::STATUS_STOP_PENDING = 'SERVICE_STOP_PENDING'

Definition at line 35 of file class.nssm.php.

Referenced by getServiceStatusDesc().

◆ STATUS_STOPPED

const Nssm::STATUS_STOPPED = 'SERVICE_STOPPED'

Definition at line 36 of file class.nssm.php.

Referenced by getServiceStatusDesc(), and isStopped().


The documentation for this class was generated from the following file: