서비스로 실행하면 Teamcity가 시작되지 않지만 실제 명령은 제대로 작동합니다.

서비스로 실행하면 Teamcity가 시작되지 않지만 실제 명령은 제대로 작동합니다.

Teamcity를 홈 서버로 설정하려고 하는데 서비스를 실행할 수 없는 것 같습니다. 이것은 우분투 16.04에 있습니다.

나는 지시를 따랐다.여기까지데이터베이스 설치 및 구성부분. (단, /opt/jetbrains/Teamcity 대신 /opt/Teamcity를 사용하고 있습니다)

이제 서비스를 실행하려고 하면 다음과 같은 메시지가 나타납니다.

sudo service teamcity start 
Job for teamcity.service failed because the control process exited with error code. See "systemctl status teamcity.service" and "journalctl -xe" for details.

그러나 스크립트에서 실제 명령을 수행할 때

sudo start-stop-daemon --start -c teamcity  --exec  /opt/TeamCity/bin/runAll.sh start

잘 작동합니다. 어떤 아이디어가 있나요?

편집하다

다음은journalctl -xe

Oct 13 23:15:59 Home-Server sudo[8224]:     ryan : TTY=pts/8 ; PWD=/opt/TeamCity/bin ; USER=root ; COMMAND=/usr/sbin/service teamcity start
Oct 13 23:15:59 Home-Server sudo[8224]: pam_unix(sudo:session): session opened for user root by ryan(uid=0)
Oct 13 23:15:59 Home-Server systemd[1]: Starting teamcity.service...
-- Subject: Unit teamcity.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit teamcity.service has begun starting up.
Oct 13 23:15:59 Home-Server systemd[8256]: teamcity.service: Failed at step EXEC spawning /etc/init.d/teamcity: Exec format error
-- Subject: Process /etc/init.d/teamcity could not be executed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- The process /etc/init.d/teamcity could not be executed and failed.
-- 
-- The error number returned by this process is 8.
Oct 13 23:15:59 Home-Server systemd[1]: teamcity.service: Control process exited, code=exited status=203
Oct 13 23:15:59 Home-Server systemd[1]: Failed to start teamcity.service.
-- Subject: Unit teamcity.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit teamcity.service has failed.
-- 
-- The result is failed.
Oct 13 23:15:59 Home-Server systemd[1]: teamcity.service: Unit entered failed state.
Oct 13 23:15:59 Home-Server systemd[1]: teamcity.service: Failed with result 'exit-code'.
Oct 13 23:15:59 Home-Server sudo[8224]: pam_unix(sudo:session): session closed for user root

답변1

10월 13일 23:15:59 홈 서버 systemd[8256]: teamcity.service: EXEC 생성 단계에서 실패했습니다. /etc/init.d/teamcity: Exec 형식 오류
-- 제목: /etc/init.d/teamcity 프로세스를 실행할 수 없습니다.

… 문제가 무엇인지 정확히 알려줍니다. 귀하의 파일은 실행 가능한 스크립트가 아닙니다. 또한 데비안 정책에 의해 오래된 van Smoorenburg 스크립트에 규정된 올바른 형식이 아니며 , 몇 년 전에 데비안에서 필수가 된 LSB 헤더는 말할 것도 없고 rcvan Smoorenburg 스크립트에 대한 오래된 RedHat/SuSE 헤더도 부족합니다 .rc

그러나 그것을 고치는 것도 시간 낭비입니다. 멀리 던져. 체계화된 서비스 단위를 사용하세요.

당신은 다음과 같은 메커니즘을 사용하고 있습니다.두 배Ubuntu에서 한 번은 upstart로 대체된 다음 다시 systemd로 대체되었습니다.

지금은 2016년이고 systemd로 마이그레이션하는 첫 번째 규칙이 적용됩니다. 그러나 지난 몇 년 동안 많은 사람들(예:벤 화이트헤드그리고이 이름없는 사람) 누가 당신에게 House of Horror 시스템에 대한 또 다른 후보를 만들도록 하시겠습니까? 하지 마라쉘 스크립트로 잘못 작성된 Poor Man's Dæmon Supervisor를 시스템 유닛 내부에 포장합니다.

[단위]
설명=팀시티
문서=https://unix.stackexchange.com/a/316369/5132

[서비스]
유형=단순
사용자=팀시티
환경=TEAMCITY_DATA_PATH=/opt/jetbrains/TeamCity/.BuildServer
환경=TEAMCITY_SERVER_OPTS=-Djava.awt.headless=true
ExecStart=/opt/jetbrains/TeamCity/bin/runAll.sh 실행

[설치하다]
WantedBy=다중 사용자.대상

추가 읽기

관련 정보