Hitachi

JP1 Version 11 JP1/Script Description and Reference (For Windows Systems)


9.5.12 ServiceControl (send a control command to a service)

Purpose

Sends a control command to a service.

Syntax
ServiceControl(ServiceInfoName, Control)
Arguments
ServiceInfoName

Specify the name of the service information object as a character string or as a variable that stores this value.

Control

Specify the control to send to the service as one of the following values:

Value

Meaning

SERVICE_CONTROL_STOP

Stop the service.

Unlike the ServiceStop command, this control command results in an error if the service is inactive.

SERVICE_CONTROL_PAUSE

Halt the service.

Same function as the ServicePause command.

SERVICE_CONTROL_CONTINUE

Resume the service.

Same function as the ServiceContinue command.

Description

The ServiceControl command sends a control command to a service, using the value stored in the keyword Name in the service information.

The service name of the service to be controlled must be set in the Name keyword in the service information.

The execution result is stored in the _SVC_RTN_ reserved variable. The command returns True on successful execution, or False for all other states.

Note

Execute the script file as a user who has administrator permissions. For details, see 1.8.2 Command behavior.

Example
' Halt the JP1/Script service.
ServiceSetValue("JSService", Name::"JP1_Script")
ServiceControl("JSService", SERVICE_CONTROL_PAUSE)
JP1/Script version

Supported from JP1/Script 01-00.