Skip to content

Instantly share code, notes, and snippets.

@tineo
Last active October 19, 2020 21:25
Show Gist options
  • Select an option

  • Save tineo/ae2b8c8e6b39fea767352f9d116c9f45 to your computer and use it in GitHub Desktop.

Select an option

Save tineo/ae2b8c8e6b39fea767352f9d116c9f45 to your computer and use it in GitHub Desktop.
Service
@echo off
:start
sc query MyService | find "STATE" | find "RUNNING"
if errorlevel 1 WMIC process Where "CommandLine Like '%% -jar myjar.jar%%'" Call Terminate
WMIC process where caption="java.exe" get commandline | findstr "myjar.jar" > nul
if errorlevel 1 sc stop MyService && sc start MyService
Sleep 10
goto start
sc create TestServ4 binPath= "D:\jdk-11.0.8\bin\java.exe "-Dserver.port=8080" "-Dspring.datasource_ser.url=jdbc:sqlserver://192.168.64.160:1433;databaseName=dbHCENTER2_REPORTES" "-Dspring.datasource_ser.username=sa" "-Dspring.datasource_ser.password=B9E555F936BEC132" -jar "D:\jdk-11.0.8\hiper-service-reporte-v2-1.0.0.jar” type= own start= auto error= normal DisplayName= TestService4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment