Hi Arcady,
You can potentially run a batch file when the service stops, and have that batch file restart other services. The trick is getting the batch file to run invisibly in the background when the service restarts to avoid the Interactive Services Detection issue.
Here's how I got a dbmlsync service to restart automatically when the remote database server process is killed:
- I set up two services, dbsrv16_svc and dbmlsync_svc:
- The dbmlsync_svc has a dependency to dbsrv16_svc:
- I've created a batch file (e.g. restartservices.cmd) to restart my services, in order (you can omit the dbsrv16 calls, if desired, due to the dependency):
net stop "SQL Anywhere - dbmlsync_svc"
net stop "SQL Anywhere - dbsrv16_svc"
net start "SQL Anywhere - dbsrv16_svc"
net start "SQL Anywhere - dbmlsync_svc" - I've created a VBScript wrapper (e.g. invis.vbs) to launch an argumented batch file in the background (invisible mode):
CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False
- I go into my services panel and in the dbsrv16_svc Recovery options set up the paths to WSCRIPT with my VBS and CMD files as the arguments:
- Back in Task Manager, I find my two Service processes running:
- Now if I PsKill the dbsrv16 service (from an Administrator Command Prompt), both services are gone:
pskill 5048 - A few seconds later, both services are back:
Hope that helps,
Jeff Albion
SAP Active Global Support