0.bat파일
cd C:\Users\Administrator\.node-red
node-red -s settings1880.js -p 1880 --location=global
2.bat파일
cd C:\Users\Administrator\.node-red
node-red -s settings1882.js -p 1882 --location=global
check02.bat 파일
@echo off
rem /* check02.bat 파일
rem 기능:1880포트 실행확인 없을시 0.bat 실행
rem 기능:1882포트 실행확인 없을시 2.bat 실행
rem */
:START
netstat -ano | find "1880" | find "LISTEN" > NUL
if not ERRORLEVEL 1 (
echo 1880 포트실행중.
goto CK1880
) else (
echo Not Run.
goto GGNG
);
:PGOK
timeout /t 15
goto START
:GGNG
start cmd /k call "C:\Users\Administrator\.node-red\0.bat"
echo Restart . %DATE% %TIME% >> c:\exec1880Log.txt
timeout /t 60
goto START
:CK1880
netstat -ano | find "1882" | find "LISTEN" > NUL
if not ERRORLEVEL 1 (
echo 1882 포트실행중.
goto PGOK
) else (
echo Not Run.
start cmd /k call "C:\Users\Administrator\.node-red\2.bat"
echo Restart . %DATE% %TIME% >> c:\exec1882Log.txt
timeout /t 60
goto START
);
nodered데몬이 여러 가지 이유로 인해 죽는경우가 계속 발생한다..
주된 원인은 스크립트 오류의 에러처리가 try catch error 만사용하고 finally 처리를 안해주면 죽게된다.
그렇다고 module 만드는분들에게 finally를 꼭 넣으셔요 라고 할수도없다.
해결법으로 사용한 스크립트이다.
1880 포트와 1882 두개의 포트로 각각 다른 서비스를 돌리고 있고
두개 포트를 각각 체크해서 새로 실행하도록 하였다.
끝.
'NodeRed' 카테고리의 다른 글
사용자 인증 httpNodeAuth와 httpStaticAuth (0) | 2023.02.28 |
---|---|
nodered KTcloud의 CentOS7에 설치 서비스 실행 등록 방법 (0) | 2022.10.23 |
nodered gmail통해email발송 위한 앱비밀번호생성법 (0) | 2022.09.27 |
nodered gmail로 email 발송 실패 문제 해결 (0) | 2022.09.19 |
라즈베리파이 최소용량 버전 설치하여 node-red 설치 (0) | 2022.08.22 |