From 8e9b6dd78f0b8b510ef9991552a6be58db71e5da Mon Sep 17 00:00:00 2001 From: Christoph Michael Becker Date: Thu, 21 Feb 2019 08:58:10 +0000 Subject: [PATCH] Win32Service Doc update Original patch provided by jbnahan@. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@346866 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/win32service/constants.xml | 145 ++++++++++++- .../functions/win32-create-service.xml | 191 +++++++++++++++++- .../functions/win32-query-service-status.xml | 6 +- 3 files changed, 326 insertions(+), 16 deletions(-) diff --git a/reference/win32service/constants.xml b/reference/win32service/constants.xml index e3a54b2154..22cf4b232a 100644 --- a/reference/win32service/constants.xml +++ b/reference/win32service/constants.xml @@ -815,6 +815,51 @@ +
+ + Win32 Recovery action + + + + Constant + Value + Description + + + + + WIN32_SC_ACTION_NONE + 0x00000000 + + No action. + + + + WIN32_SC_ACTION_REBOOT + 0x00000001 + + Restart the server. + + + + WIN32_SC_ACTION_RESTART + 0x00000002 + + Restart the service. + + + + WIN32_SC_ACTION_RUN_COMMAND + 0x00000003 + + Run a command. + + + + +
+
+
Win32 Service informations @@ -828,53 +873,137 @@ - Win32_INFO_SERVICE + WIN32_INFO_SERVICE "service" - Win32_INFO_DISPLAY + WIN32_INFO_DISPLAY "display" - Win32_INFO_USER + WIN32_INFO_USER "user" - Win32_INFO_PASSWORD + WIN32_INFO_PASSWORD "password" - Win32_INFO_PATH + WIN32_INFO_PATH "path" - Win32_INFO_PARAMS + WIN32_INFO_PARAMS "params" - Win32_INFO_DESCRIPTION + WIN32_INFO_DESCRIPTION "description" - Win32_INFO_START_TYPE + WIN32_INFO_START_TYPE "start_type" + + INFO_LOAD_ORDER + "load_order" + + + + + INFO_SVC_TYPE + "svc_type" + + + + + INFO_ERROR_CONTROL + "error_control" + + + + + INFO_DELAYED_START + "delayed_start" + + + + + INFO_BASE_PRIORITY + "base_priority" + + + + + INFO_DEPENDENCIES + "dependencies" + + + + + INFO_RECOVERY_DELAY + "recovery_delay" + + + + + INFO_RECOVERY_ACTION_1 + "recovery_action_1" + + + + + INFO_RECOVERY_ACTION_2 + "recovery_action_2" + + + + + INFO_RECOVERY_ACTION_3 + "recovery_action_3" + + + + + INFO_RECOVERY_RESET_PERIOD + "recovery_reset_period" + + + + + INFO_RECOVERY_ENABLED + "recovery_enabled" + + + + + INFO_RECOVERY_REBOOT_MSG + "recovery_reboot_msg" + + + + + INFO_RECOVERY_COMMAND + "recovery_command" + + +
diff --git a/reference/win32service/functions/win32-create-service.xml b/reference/win32service/functions/win32-create-service.xml index 1775b8ca5b..868927317f 100644 --- a/reference/win32service/functions/win32-create-service.xml +++ b/reference/win32service/functions/win32-create-service.xml @@ -14,7 +14,7 @@ stringmachine - Attempts to add a service into the SCM database. Administrative + Attempts to add a service into the SCM database. Administrative privileges are required for this to succeed. @@ -168,6 +168,111 @@ + + dependencies + + + To define the dependencies for your service, it may be necessary to set + this parameter to the list of the services names in an array. + + + + + recovery_delay + + + This parameter defines the delay between the fail and the execution + of recovery action. The value is in milliseconds. + + + The default value is 60000. + + + + + recovery_action_1 + + + The action will be executed on first failure. The default value is + WIN32_SC_ACTION_NONE. + + + The recovery_action_1 can be set to one of the + constants defined in + Win32 Recovery action. + + + + + recovery_action_2 + + + The action will be executed on second failure. The default value is + WIN32_SC_ACTION_NONE. + + + The recovery_action_2 can be set to one of the + constants defined in + Win32 Recovery action. + + + + + recovery_action_3 + + + The action will be executed on next failures. The default value is + WIN32_SC_ACTION_NONE. + + + The recovery_action_3 can be set to one of the + constants defined in + Win32 Recovery action. + + + + + recovery_reset_period + + + The failure count will be reset after the delay defined in the parameter. The delay is expirement in seconds. + + + The default value is 86400. + + + + + recovery_enabled + + + Set this parameter at &true; to enable the recovery settings, &false; + to disable. + + + The default value is &false; + + + + + recovery_reboot_msg + + + Set this parameter to define the message saved into the Windows Event + Log before the reboot. Used only if one action is set to + WIN32_SC_ACTION_REBOOT. + + + + + recovery_command + + + Set this parameter to define the command executed when one action is defined on + WIN32_SC_ACTION_RUN_COMMAND. + + + @@ -204,10 +309,61 @@ 'dummyphp', # the name of your service - 'display' => 'sample dummy PHP service', # short description - 'description' => 'This is a dummy Windows service created using PHP.', # long description - 'params' => '"' . __FILE__ . '" run', # path to the script and parameters + 'service' => 'dummyphp', // the name of your service + 'display' => 'sample dummy PHP service', // short description + 'description' => 'This is a dummy Windows service created using PHP.', // long description + 'params' => '"' . __FILE__ . '" run', // path to the script and parameters +)); +debug_zval_dump($x); +?> +]]> + + + + + + A <function>win32_create_service</function> example with dependencies + + Create a service with the short name 'dummyphp' and dependencies. + + + 'dummyphp', // the name of your service + 'display' => 'sample dummy PHP service', // short description + 'description' => 'This is a dummy Windows service created using PHP.', // long description + 'params' => '"' . __FILE__ . '" run', // path to the script and parameters + 'dependencies' => array("Netman"), // The list of the dependencies +)); +debug_zval_dump($x); +?> +]]> + + + + + + A <function>win32_create_service</function> example with recovery + + Create a service with the short name 'dummyphp' and recovery settings. + + + 'dummyphp', // the name of your service + 'display' => 'sample dummy PHP service', // short description + 'description' => 'This is a dummy Windows service created using PHP.', // long description + 'params' => '"' . __FILE__ . '" run', // path to the script and parameters + 'recovery_delay' => 120000, // Recovery action is executed after 2 minutes + 'recovery_action_1' => WIN32_SC_ACTION_RESTART, // On first failure, restart the service + 'recovery_action_2' => WIN32_SC_ACTION_RUN_COMMAND, // On second failure, execute the commmand + 'recovery_action_3' => WIN32_SC_ACTION_NONE, // On other failure, do nothing + 'recovery_reset_period' => 86400, // Reset the fail counter after 1 day + 'recovery_enabled' => true, // Enable the recovery parameter + 'recovery_reboot_msg' => null, // Do not define a reboot message, it's not needed here + 'recovery_command' => "c:\clean-service.bat", // When the action is WIN32_SC_ACTION_RUN_COMMAND, execute this command )); debug_zval_dump($x); ?> @@ -217,12 +373,37 @@ debug_zval_dump($x); + + +&reftitle.changelog; + + + + + +&Version; +&Description; + + + + +0.4.0 + + The dependencies, recovery_delay,recovery_action_1, recovery_action_2, recovery_action_3, recovery_reset_period, recovery_enabled, recovery_reboot_msg and recovery_command parameters have been added. + + + + + + + &reftitle.seealso; win32_delete_service Win32 Base Priority Classes + Win32 Recovery action Win32 Error Codes diff --git a/reference/win32service/functions/win32-query-service-status.xml b/reference/win32service/functions/win32-query-service-status.xml index 1b6b0b6418..9a328db67e 100644 --- a/reference/win32service/functions/win32-query-service-status.xml +++ b/reference/win32service/functions/win32-query-service-status.xml @@ -83,7 +83,7 @@ WIN32_ERROR_SERVICE_SPECIFIC_ERROR if the exit mode is not gracefuly. See Win32Service error codes and - win32_set_service_exit_mode + win32_set_service_exit_mode @@ -93,7 +93,7 @@ If the service exited with an error condition, the service specific code that is logged in the event log is visible here. This value is equal - to the value defined by win32_set_service_exit_code + to the value defined by win32_set_service_exit_code @@ -122,7 +122,7 @@ ProcessId - The Windows process identifier. If 0, the process is not running. + The Windows process identifier. If 0, the process is not running.