1

I'm trying to setup teamcity as a home server but I can't seem to get the service to run. This is on ubuntu 16.04.

I followed the instructions here until the Install and configure database part. (Except I'm just using /opt/Teamcity rather than /opt/jetbrains/Teamcity)

Now when I try to run the service I get this

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.

However when I do the actual command in the script

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

It works fine. Any ideas?

EDIT

Here's the output of 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
  • Do what the message said and add the output to your question. – user1133275 Oct 14 '16 at 3:05
5
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

… which tells you exactly what the problem is. Your file is not an executable script. It's also not in the correct form that is prescribed for old van Smoorenburg rc scripts by Debian Policy, lacking even the old RedHat/SuSE headers for van Smoorenburg rc scripts, let alone the LSB ones that became mandatory on Debian years ago.

But it's also a waste of time to fix it. Throw it away. Use a systemd service unit.

You're using a mechanism that has twice been superseded on Ubuntu, once by upstart and then again by systemd.

It is now 2016, and the first rule for migrating to systemd applies. However, you should ignore the many people over the past several years (such as Ben Whitehead and this nameless person) who would have you create another candidate for the systemd House of Horror. Do not wrap a Poor Man's Dæmon Supervisor, written badly in shell script, inside a systemd unit.

[Unit]
Description=TeamCity
Documentation=https://unix.stackexchange.com/a/316369/5132

[Service]
Type=simple
User=teamcity
Environment=TEAMCITY_DATA_PATH=/opt/jetbrains/TeamCity/.BuildServer
Environment=TEAMCITY_SERVER_OPTS=-Djava.awt.headless=true
ExecStart=/opt/jetbrains/TeamCity/bin/runAll.sh run

[Install]
WantedBy=multi-user.target

Further reading

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.