centos7部署tomcat:
参考网址:https://www.cnblogs.com/joe2047/p/9588847.html
tomcat上部署Jenkins:
参考网址:https://blog.csdn.net/q13554515812/article/details/83211508
写启动jenkins服务脚本,命令如下
vim /etc/init.d/jenkins
脚本内容如下:
#!/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/tomcat.pid # Set Tomcat environment. JENKINS_USER=root LOCKFILE=/var/lock/jenkins export PATH=/usr/local/bin:$PATH export HOME=/jenkins export JAVA_HOME=/usr/lib/jvm/java-1.8.0 export JENKINS_BASEDIR=/jenkins export TOMCAT_HOME=/usr/local/tomcat export CATALINA_PID=$JENKINS_BASEDIR/jenkins-tomcat.pid export CATALINA_OPTS="-DJENKINS_HOME=$JENKINS_BASEDIR/jenkins-home -Xmx512m -Djava.awt.headless=true" [ -f $TOMCAT_HOME/bin/catalina.sh ] || exit 0 export PATH=$PATH:/usr/bin:/usr/local/bin # See how we were called. case "$1" in start) # Start daemon. echo -n "Starting Tomcat: " su -p -s /bin/sh $JENKINS_USER -c "$TOMCAT_HOME/bin/catalina.sh start" RETVAL=$? echo [ $RETVAL = 0 ] && touch $LOCKFILE ;; stop) # Stop daemons. echo -n "Shutting down Tomcat: " su -p -s /bin/sh $JENKINS_USER -c "$TOMCAT_HOME/bin/catalina.sh stop" RETVAL=$? echo [ $RETVAL = 0 ] && rm -f $LOCKFILE ;; restart) $0 stop $0 start ;; condrestart) [ -e $LOCKFILE ] && $0 restart ;; status) status tomcat ;; *) echo "Usage: $0 {start|stop|restart|status}" exit 1 esac exit 0