-
-
Save yfix/3262441a1ab35a12232e to your computer and use it in GitHub Desktop.
This file contains 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