A systemd service configuration for Jetbrains Teamcity v2017
[Teamcity, systemd, service]
Executive summary: Use the 'run' option instead of the 'start' option.
Teamcity takes a while to start up. Using the conventional 'start' option requires a hand-off from the synchronous startup code (that starts the JVM and the Teamcity server) to the PID file. Timing issues means this doesn't always work as well as required. Using the 'rubn' option and letting systemd do the process management yields a simpler more robust solution.
Service file '/usr/lib/systemd/system/teamcity.service':
[Unit] Description=JetBrains TeamCity Requires=network.target After=syslog.target network.target [Service] Type=simple EnvironmentFile=/etc/sysconfig/teamcity ExecStart=/srv/teamcity/teamcity/bin/teamcity-server.sh run ExecStop=/srv/teamcity/teamcity/bin/teamcity-server.sh stop User=teamcity [Install] WantedBy=multi-user.target
Note: Don't use the runAll.sh script as this runs both the server and the agent.
Links
- https://confluence.jetbrains.com/display/TCD10/Configuring+TeamCity+Server+Startup+Properties
- https://unix.stackexchange.com/questions/316302/teamcity-wont-start-when-run-as-service-but-actual-command-works-fine
- https://gist.github.com/BenWhitehead/9422087
- https://gist.github.com/kwoods/5756cae6a6e47774ce97de3a7f0d8b38