[gradle] org.hidetake.ssh + sleep

Logan. K.
Logan. K.
Aug 9, 2017 · 1 min read

개인 프로젝트를 만들면서 gradle ssh를 이용하여 jar배포를 하고 있는데 java process가 실행이 안되는 문제가 있었습니다. jar파일을 업로드하고 링크를 걸고 기존 프로세스 stop하고 새로 start하는 간단한 로직인데.. java가 실행되자 마자 죽는 것 처럼 보였습니다. 그래서 일단 jar를 upload하고 수동으로 java를 실행했었는데 너무 불편해서 이것 저것 해보면서 원인을 파악했습니다.

deploy.gradle파일 내용은 아래와 같고, 문제를 해결한 후 정상 동작하는 파일 내용입니다.

sh /tok/run.sh start후 sleep을 줘서 해결했습니다.

execute 'sh /tok/run.sh start; sleep 3;'

ssh로 command를 실행하고 바로 close를 해버려서 java가 실행되는 도중에 죽는 듯 하였습니다. 마치 terminal에서 어떤 프로세스를 실행하고 terminal을 닫아 버리면 프로세스가 죽는 것과 같은 것이 아닐까 추측해봅니다.

Logan. K.

Written by

Logan. K.

일찍 일어나라 그리고 열심히 일해라. 성공을 위한 법칙은 이것 뿐이다. B형. 얼리버드. 개발자. DevOoops.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade