Last active
October 19, 2020 21:25
-
-
Save tineo/ae2b8c8e6b39fea767352f9d116c9f45 to your computer and use it in GitHub Desktop.
Service
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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