Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've successfully installed TeamCity ib CentOS 6.2 Minimal. I'm stuck on trying to run a script automatically on system startup:

/opt/TeamCity/bin/ start

I've googled around and tried various methods all of which seems to fail. Most of the methods points to adding the startup script to one of the rc.local files:


And the contents of rc.local contains the line:

/opt/TeamCity/bin/ start

None of which will start the teamcity server

There are no problems if i run the script manually.

Seems simple but how do i get a shell script to auto run?

share|improve this question
You'll need to describe what you mean by 'none of which works'. Because without it, everyone's guessing. Maybe describe in more detail what you've done and what output or failure messages or events occurred? – EightBitTony May 14 '12 at 17:06
that is the correct place to put it, so it seems that something is not kosher with the /etc/rc.d/rc.local entry or with the script itself. Are you able to post the contents of the script & the rc.local? Also, does the shell script run when you do it manually? – Quinn Murphy May 14 '12 at 17:09
Yes, the teamcity-server runs fine manually. But its not practical to do this every time the server is restarted... – user1133619 May 14 '12 at 17:15
Getting it to run manually but not through rc.local implies environmental differences. What's your PATH? Any other env variables? – cjc May 14 '12 at 18:00
@cjc Not sure what you mean by 'PATH' - However if i run /etc/rc.d/rc.local manually the teamcity server can also start fine. Does this still make a difference? – user1133619 May 15 '12 at 2:04

When the script is run manually, it works correctly. But, when run automatically it doesn't work.

I've found the culprit: TeamCity runs under the user teamcity. It must be present in the /etc/sudoers file and you should add, using visudo a line like this:

Defaults:teamcity !requiretty
share|improve this answer

in Fedora 17 command

# chkconfig --add teamcity-server

say: service teamcity-server does not support chkconfig you should add header like:

#! /bin/bash
# chkconfig: - 10 90

only after that run first command.

share|improve this answer
And make sure your script is located in /etc/init.d/ :-) – Bart De Vos Oct 2 '12 at 12:42

If the teamcity start script is a LSB-compliant init script (that is, if it provides start, stop and other arguments), you can just copy the script to /etc/init.d folder and run (as root):

# chkconfig --add <script_name>
# chkconfig <script_name> on

A symbolic link for the file should be OK too. So try (as root):

# ln -s /opt/TeamCity/bin/ /etc/init.d/teamcity-server
# chkconfig --add teamcity-server
# chkconfig teamcity-server on

If it doesn't start on initialization, but starting manually without problems, you should check:

  1. permissions (maybe the program can not be run as root, did you tried to log on as root and run it?), and;
  2. your PATH (maybe the script need something but it does not know where it is).

To print the content of your PATH just run:

echo $PATH

To check if the reason to the script not start is the PATH, try:

$ cd /
$ PATH= /opt/TeamCity/bin/

This command will temporary clear your PATH and run the command. If the command need some specific info on the PATH it will fail (be careful to run exactly as stated above, THERE IS a space between PATH= and the remaining of the command).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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