Skip to content

Instantly share code, notes, and snippets.

@solnic

solnic/gist:911313

Created Apr 9, 2011
Embed
What would you like to do?
#!/bin/sh
#
# Startup script for the Jenkins Continuous Integration server
# (via Jakarta Tomcat Java Servlets and JSP server)
#
# chkconfig: - 85 15
# description: Jakarta Tomcat Java Servlets and JSP server
# processname: tomcat
# pidfile: /var/run/jenkins.pid
# Set Tomcat environment.
JENKINS_USER=jenkins
LOCKFILE=/var/lock/jenkins
export PATH=/usr/local/bin:$PATH
export HOME=/home/jenkins
export JAVA_HOME=/usr/lib/jvm/java-6-openjdk
export JENKINS_BASEDIR=/home/jenkins
export PATH=$PATH:/usr/bin:/usr/local/bin
# See how we were called.
case "$1" in
start)
echo -n "Starting Jenkins: "
su -s /bin/sh jenkins -c "
cd /
JENKINS_HOME=/home/jenkins exec setsid /usr/bin/java \
-jar /home/jenkins/lib/jenkins.war \
$JENKINS_OPTS \
</dev/null >>/home/jenkins/logs/console_log 2>&1 &
echo \$! >/home/jenkins/run/jenkins.pid
disown \$!
"
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch $LOCKFILE
;;
stop)
# Stop daemons.
echo -n "Shutting down Jenkins: "
su -p -s /bin/sh $JENKINS_USER -c ""
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f $LOCKFILE
;;
restart)
$0 stop
$0 start
;;
condrestart)
[ -e $LOCKFILE ] && $0 restart
;;
status)
status jenkins
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.