I'm installing a Windows Service via The question is, can I set these parameters via commandline so that the database restarts when it happens to fail? I could not find any mention in the docs. Any alternative way is welcome. |
You can use the Windows sc command line utility to configure services. For example, to make restart the action on failure: sc failure SQLANYs_servicename actions= restart/60000/restart/60000// reset= 240 this will set the failure actions of the database engine service SQLANYs_servicename to re-start after sixty seconds on the first two failures and then do nothing. The reset command re-sets the failure counter after 4 minutes. (NB as Jeff points out the actual service name is "SQLANYs__" in front of whatever you called it!) You can also use sc config to set things like delayed start-up, service dependencies etc. See sc /? for full details. One thing to note is that the positioning of the equals signs is vital. There must be no space between the keyword (eg "actions" or "reset") and the equals sign, and there must be a space after the equals sign.
(17 Sep '12, 07:34)
Justin Willey
Using 'sc' solves it, thanks.
(19 Sep '12, 10:52)
henginy
|
No, there is currently no way to do this using dbsvc. I will add it to my list of features to investigate for a future release. Thanks. It's not critical since there's a way around, but might be easier with a switch=)
(19 Sep '12, 10:59)
henginy
|
There is no current way to control this behaviour via dbsvc. The service restart parameters are specified in the Registry as the "FailureActions" REG_BINARY value. This information is based on the SERVICE_FAILURE_ACTIONS / SC_ACTION data structures although without investigating further, it's difficult to see how these values are related. You can try creating a service, manually configure it through the Windows Service manager, and then see if copying the REG_BINARY value to another service definition in the Registry. The SQL Anywhere registry service information can be found underneath: \\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SQLANYs_servicename Where servicename is the name provided via the "-sn" switch. You can then apply the registry setting via the "reg" command at the Command Prompt. I think sc command does necessary updates to the registry. Thanks for the answer.
(19 Sep '12, 10:52)
henginy
|