Skip to content

Commit

Permalink
0003431: Recovery options for service wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
erilong committed Feb 23, 2018
1 parent fd1b760 commit 28452a3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
9 changes: 6 additions & 3 deletions symmetric-server/src/main/deploy/conf/sym_service.conf
Expand Up @@ -98,23 +98,26 @@ wrapper.ntservice.starttype=delay
# Service dependencies. Use + prefix for groups.
wrapper.ntservice.dependency.1=

# First failure action (NONE, RESTART)
# First failure action (NONE, RESTART, RUN_COMMAND)
wrapper.ntservice.failure.action.type.1=RESTART

# Milliseconds to wait before performing the action
wrapper.ntservice.failure.action.delay.1=10000

# Second failure action (NONE, RESTART)
# Second failure action (NONE, RESTART, RUN_COMMAND)
wrapper.ntservice.failure.action.type.2=NONE

# Milliseconds to wait before performing the action
wrapper.ntservice.failure.action.delay.2=0

# Subsequent failure action (NONE, RESTART)
# Subsequent failure action (NONE, RESTART, RUN_COMMAND)
wrapper.ntservice.failure.action.type.3=NONE

# Milliseconds to wait before performing the action
wrapper.ntservice.failure.action.delay.3=0

# Seconds after which to reset the failure count to zero
wrapper.ntservice.failure.reset.period=300

# For failure action type RUN_COMMAND, the command line to run
wrapper.ntservice.failure.action.command=
Expand Up @@ -348,7 +348,7 @@ public void install() {
}

WinsvcEx.SERVICE_FAILURE_ACTIONS actions = new WinsvcEx.SERVICE_FAILURE_ACTIONS(config.getFailureResetPeriod(), "",
config.getFailureActionCommand(), failureActions.size(), actionRef);
new WString(config.getFailureActionCommand()), failureActions.size(), actionRef);
advapi.ChangeServiceConfig2(service, WinsvcEx.SERVICE_CONFIG_FAILURE_ACTIONS, actions);

WinsvcEx.SERVICE_FAILURE_ACTIONS_FLAG flag = new WinsvcEx.SERVICE_FAILURE_ACTIONS_FLAG(false);
Expand Down
Expand Up @@ -28,6 +28,7 @@

import com.sun.jna.Pointer;
import com.sun.jna.Structure;
import com.sun.jna.WString;
import com.sun.jna.platform.win32.Winsvc;

@IgnoreJRERequirement
Expand Down Expand Up @@ -104,14 +105,14 @@ protected List<String> getFieldOrder() {
public static class SERVICE_FAILURE_ACTIONS extends SERVICE_INFO {
public int dwResetPeriod;
public String lpRebootMsg;
public String lpCommand;
public WString lpCommand;
public int cActions;
public SC_ACTION.ByReference lpsaActions;

public SERVICE_FAILURE_ACTIONS() {
}

public SERVICE_FAILURE_ACTIONS(int dwResetPeriod, String lpRebootMsg, String lpCommand, int cActions, SC_ACTION.ByReference lpsaActions) {
public SERVICE_FAILURE_ACTIONS(int dwResetPeriod, String lpRebootMsg, WString lpCommand, int cActions, SC_ACTION.ByReference lpsaActions) {
this.dwResetPeriod = dwResetPeriod;
this.lpRebootMsg = lpRebootMsg;
this.lpCommand = lpCommand;
Expand Down

0 comments on commit 28452a3

Please sign in to comment.