
我正在嘗試將 teamcity 設定為家庭伺服器,但我似乎無法運行該服務。這是在 ubuntu 16.04 上。
我按照說明進行操作這裡直到安裝和配置資料庫部分。 (除了我只是使用 /opt/Teamcity 而不是 /opt/jetbrains/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 Home-Server systemd[8256]:teamcity.service:在步驟 EXEC 產生 /etc/init.d/teamcity 時失敗:Exec 格式錯誤 -- 主題:進程 /etc/init.d/teamcity 無法執行
……它準確地告訴您問題是什麼。您的文件不是可執行腳本。它也不是 Debian 政策為舊的 van Smoorenburg 腳本規定的正確形式rc
,甚至缺少 van Smoorenburg 腳本的舊 RedHat/SuSE 標頭rc
,更不用說幾年前在 Debian 上強制使用的 LSB 標頭了。
但修復它也是浪費時間。把它丟掉。使用 systemd 服務單元。
您正在使用一種機制兩次在 Ubuntu 上被取代,一次被 upstart 取代,然後再被 systemd 取代。
現在是 2016 年,遷移到 systemd 的第一條規則適用。然而,你應該忽略過去幾年的許多人(例如本懷特海德和這個無名之人)誰會讓你為 systemd House of Horror 創建另一個候選人。 不要將一個窮人的守護程式管理程式(用 shell 腳本寫得很糟糕)包裝在一個 systemd 單元內。
[單元] 描述=TeamCity 文檔=https://unix.stackexchange.com/a/316369/5132 [服務] 型態=簡單 用戶=teamcity 環境=TEAMCITY_DATA_PATH=/opt/jetbrains/TeamCity/.BuildServer 環境=TEAMCITY_SERVER_OPTS=-Djava.awt.headless=true ExecStart=/opt/jetbrains/TeamCity/bin/runAll.sh 運行 [安裝] WantedBy=多用戶.target
進一步閱讀
- https://unix.stackexchange.com/a/316168/5132
- https://askubuntu.com/a/626858/43344
- 喬納森·德博因·波拉德 (2015)。 systemd 恐怖屋。經常給的答案。