Hitachi

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


9.5.5 ServiceStart (start a service)

Purpose

Starts a service.

Syntax
ServiceStart(ServiceInfoName)
Argument
ServiceInfoName

Specify the service information name of the service to be started. Write a character string or a variable that stores this value.

Description

The ServiceStart command starts a service registered in the system, using the value stored in the keyword Name in the service information.

The execution result is stored in the _SVC_RTN_ reserved variable. The command returns True on successful execution, or LOGON_FAILED if the service fails to start due to an invalid account. False is returned for all other states.

Note

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

Important note

Do not execute this command for services that cannot start. This command issues a start request to the specified service, and will not terminate until the specified service has started.

Example
' Register and start the JP1/Script service if it does
' not already exist.
ServiceSetValue("JSService", Name::"JP1_Script")
If  IsExistService("JSService") = False  Then
  OutDir = "C:\Program Files\Hitachi\Script\BIN\"
  ServiceSetValue("JSService", Name::"JP1_Script"   _
                   , DispName::"JP1/Script"   _
                   , Type::SERVICE_WIN32_OWN_PROCESS   _
                   , Start::SERVICE_AUTO_START   _
                   , Errctl::SERVICE_ERROR_NORMAL   _
                   , Path::OutDir+"SPTHSV.EXE")
  ServiceCreate("JSService")
End
ServiceStart("JSService")
JP1/Script version

Supported from JP1/Script 01-00.