Centos/ubuntu jenkins. war is a self-starting script. in Linux, the jar package is stopped after Linux is started. centosjenkins. war

Source: Internet
Author: User

Centos/ubuntu jenkins. war is a self-starting script. in Linux, the jar package is stopped after Linux is started. centosjenkins. war

#! /Bin/sh # chkconfig: 2345 10 90 # description: jenkins .... # This script will be executed * after * all the other init scripts. # You can put your own initialization stuff in here if you don't # want to do the full Sys V style init stuff. # prefix =/home/lanmps/jenkins # nohup $ prefix/start_jenkins.sh> $ prefix/jenkins. log 2> & 1 & # coming soon. stay Fox JENKINS_ROOT =/home/lanmps/jenkinsJENKINSFILENAME = jenkins. war # stop method stop () {echo "Stoping $ JENKINSFILENAME" ps-ef | grep $ JENKINSFILENAME | awk '{print $2}' | while read piddo kill-9 $ pid echo "$ pid kill" done} case "$1" instart) echo "Starting $ JENKINSFILENAME" nohup $ JENKINS_ROOT/start_jenkins.sh> $ JENKINS_ROOT/jenkins. log 2> & 1 &; stop) stop; restart) stop start; status) ps-ef | grep $ JENKINSFILENAME; *) printf'usage: % s {start | stop | restart | status} \ N' "$ prog" exit 1; esac

Save as jenkins. sh In the jenkins directory

JENKINS_ROOT is the jenkins directory.

1. centos

ln -s /home/lanmps/jenkins/jenkins.sh /etc/init.d/jenkinschkconfig --add jenkinschkconfig --level 345 jenkins on
Startup Mode
/etc/init.d/jenkins start
2. ubuntu

ln -s /home/lanmps/jenkins/jenkins.sh /etc/init.d/jenkinsupdate-rc.d -f jenkins defaults
Startup Mode
/etc/init.d/jenkins start

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.