'Tools'에 해당되는 글 29건

  1. 2023.07.19 windows service 모니터 후 restart 하기 2
  2. 2023.05.22 Dark mode 색조정
  3. 2023.05.09 J2DBC 참조
  4. 2023.05.09 web Flux 참조
Tools/MS Windows2023. 7. 19. 00:01
728x90

서비스가 stop할 경우, 다시 start 하기

 

batch에서 service_name 로 변수 정의된 서비스가 stop되면, restart 하게 하는 batch 입니다.

window 용이라, encoding을 euc-kr로 했습니다.

* 주의사항
1. batch를 관리자 권한으로 실행하세요.
 - 바로가기를 만드 후, [속성] > [고급] 에서 "관리자 권한으로 실행" 체크 후, 바로가기를 실행하면 편합니다.

 

@echo off
rem service 가 stop 되면 restart 위한 batch 입니다. encoding: euc-kr
setlocal

:init
rem cmd 실행경로설정. for logfile
cd C:\testcmd
set service_name=AMD External Events Utility
set logfile=monitor_service.log
@echo [%date% %time%] Start monitoring the "%service_name%" service.>> %logfile%
@echo [%date% %time%] Start monitoring the "%service_name%" service.
@echo [%date% %time%] "%service_name%"를 stop하려면, batch를 먼저 중지하세요.
@echo [%date% %time%] "%service_name%"를 start 후, 다시 batch를 관리자 권한으로 시작하세요.

rem monitoring loop
:loop
rem sleep 시간 설정(초). 시간이 너무 짧으면 service 가 stop 할 때 실패하션 종료되지 않을 수 있음.
timeout 10 > NUL
rem service가 STOPPED 인지 조사함. STOPPED이면 1 아니면 0
for /f "tokens=*" %%a in ('sc query "%service_name%" ^| find /c "STOPPED"') do set result=%%a
if %result% == 1 goto restart
goto loop

rem restart
:restart
@echo [%date% %time%] %service_name% restart >> %logfile%
sc start "%service_name%" >> %logfile%
goto loop

 

ps1. 스크립트를 짜기는 했는데, windows service에서 exit 코드로 restart 옵션이 있네요.

결국 스크립트를 사용하지 않고, 프로그램에서 exit : 2 이면 restart 하도록 windows service 를 설정하였습니다. ㅠㅠ;;;;

nssm set 서비스명 AppExit 2 Restart

 

ps2. java 또는 다른 프로그램을 windows service로 사용하려면 아래 프로그램 참조하세요.

https://nssm.cc/

 

NSSM - the Non-Sucking Service Manager

NSSM - the Non-Sucking Service Manager nssm is a service helper which doesn't suck. srvany and other service helper programs suck because they don't handle failure of the application running as a service. If you use such a program you may see a service lis

nssm.cc

ps3. 추가로 windows service가  2대의 서버에서 active - standby 로 동작도 가능하네요. 궁금하신 분은 아래글 참조하세요.

https://m.blog.naver.com/sik7854/221840130271

 

Windows 이중화 - Teaming

이중화란?? 시스템의 신뢰성을 올리기 위해서 같은 기능을 가진 시스템을 두 개 준비하여 활용하는 것을 말...

blog.naver.com

end.

 

728x90
Posted by 하루y
Tools/Notepad++2023. 5. 22. 20:48
728x90

markdown Panel 에 Dark 모드 적용하고, toolbar 아이콘 색상을 선명하게 보기위해서,

1) 환경설정에서 Dark mode 설정 후, 색조를 사용자 정의로 설정함.

 

end.

 

 

728x90

'Tools > Notepad++' 카테고리의 다른 글

[Notepad++] dart for User Defined Language file  (0) 2021.03.30
Posted by 하루y
Tools/Spring2023. 5. 9. 14:23
728x90

https://docs.spring.io/spring-data/r2dbc/docs/1.2.2/reference/html/#r2dbc.core

728x90

'Tools > Spring' 카테고리의 다른 글

Spring 관련 한글 문서  (0) 2023.10.06
[SpringBoot 2.7.*] H2 Jdbc 설정, schema(DDL) 및 data(DML)  (0) 2023.09.16
spring application.properties 정보  (0) 2023.08.18
web Flux 참조  (0) 2023.05.09
Posted by 하루y
Tools/Spring2023. 5. 9. 14:21
728x90

 

 

https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Flux.html#window-int-

 

Flux (reactor-core 3.5.5)

 

projectreactor.io

https://docs.spring.io/spring-framework/reference/web-reactive.html

 

Web on Reactive Stack :: Spring Framework

 

docs.spring.io

 

 

728x90

'Tools > Spring' 카테고리의 다른 글

Spring 관련 한글 문서  (0) 2023.10.06
[SpringBoot 2.7.*] H2 Jdbc 설정, schema(DDL) 및 data(DML)  (0) 2023.09.16
spring application.properties 정보  (0) 2023.08.18
J2DBC 참조  (0) 2023.05.09
Posted by 하루y