Created
April 16, 2014 18:17
-
-
Save AlainODea/10916188 to your computer and use it in GitHub Desktop.
sysv init.d script for TeamCity (tested on Ubuntu)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# chkconfig: 235 10 90 | |
# description: TeamCity startup script | |
# | |
TEAMCITY_USER=teamcity | |
TEAMCITY_DIR=/home/teamcity/TeamCity/ | |
TEAMCITY_SERVER=bin/teamcity-server.sh | |
TEAMCITY_DATADIR="/home/teamcity/.BuildServer" | |
CATALINA_OPTS="-Djava.net.preferIPv4Stack=true -Djava.net.preferIPv4Addresses" | |
case "$1" in | |
start) | |
iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 443 -j REDIRECT --to-port 8543 | |
sudo -u $TEAMCITY_USER -s -- sh -c "cd $TEAMCITY_DIR; TEAMCITY_DATA_PATH=$TEAMCITY_DATADIR CATALINA_OPTS='$CATALINA_OPTS' $TEAMCITY_SERVER start" | |
;; | |
stop) | |
sudo -u $TEAMCITY_USER -s -- sh -c "cd $TEAMCITY_DIR; TEAMCITY_DATA_PATH=$TEAMCITY_DATADIR CATALINA_OPTS='$CATALINA_OPTS' $TEAMCITY_SERVER stop" | |
;; | |
*) | |
echo "Usage: $0 {start|stop}" | |
exit 1 | |
;; | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Running on Debian 7.5 (wheezy) I had to run the following
update-rc.d teamcity defaults
to set it up to run.