Created
February 7, 2012 03:54
-
-
Save wataru420/1757063 to your computer and use it in GitHub Desktop.
Jenkins init script for centos
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
/usr/sbin/groupadd -g 30119 jenkins | |
/usr/sbin/useradd -u 30119 -g jenkins jenkins | |
mkdir /home/jenkins | |
chown -R jenkins. /home/jenkins |
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
chown -R jenkins. /usr/local/jenkins | |
chmod a+x /usr/local/jenkins/start-jenkins.sh | |
chmod a+x /usr/local/jenkins/stop-jenkins.sh | |
chmod a+x /etc/init.d/jenkins |
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
wget http://mirrors.jenkins-ci.org/war/latest/jenkins.war | |
sudo mkdir /usr/local/jenkins | |
sudo cp jenkins.war /usr/local/jenkins/ |
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 | |
# | |
# jenkins Start/Stop the Jenkins Continuous Integration server. | |
# Source function library. | |
. /etc/rc.d/init.d/functions | |
# Get config. | |
. /etc/sysconfig/network | |
# Check that networking is up. | |
[ "${NETWORKING}" = "no" ] && exit 0 | |
startup=/usr/local/jenkins/start-jenkins.sh | |
shutdown=/usr/local/jenkins/stop-jenkins.sh | |
export JAVA_HOME=/usr/local/java/ | |
JENKINS_USER=jenkins | |
start(){ | |
echo -n $"Starting Jenkins service: " | |
su - $JENKINS_USER -c $startup | |
RETVAL=$? | |
echo | |
} | |
stop(){ | |
action $"Stopping Jenkins service: " | |
su - $JENKINS_USER -c $shutdown | |
RETVAL=$? | |
echo | |
} | |
status(){ | |
numproc=`ps -ef | grep [j]enkins.war | wc -l` | |
if [ $numproc -gt 0 ]; then | |
echo "Jenkins is running..." | |
else | |
echo "Jenkins is stopped..." | |
fi | |
} | |
restart(){ | |
stop | |
sleep 5 | |
start | |
} | |
# See how we were called. | |
case "$1" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
status) | |
status | |
;; | |
restart) | |
restart | |
;; | |
*) | |
echo $"Usage: $0 {start|stop|status|restart}" | |
exit 1 | |
esac | |
exit 0 |
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 | |
JENKINS_WAR=/usr/local/jenkins/jenkins.war | |
JENKINS_LOG=/home/jenkins/jenkins.log | |
JAVA=/usr/local/java/bin/java | |
nohup nice $JAVA -jar $JENKINS_WAR > $JENKINS_LOG 2>&1 & |
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 | |
kill `ps -ef | grep [j]enkins.war | awk '{ print $2 }'` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice - Maybe add as a inital point:
To re-route 8080 to 80