zoukankan      html  css  js  c++  java
  • centos/ubuntujenkins.war自启动脚本,Linux启动停止jar包的运行案例

    #! /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 &
    #风来了.呆狐狸
    
    JENKINS_ROOT=/home/lanmps/jenkins
    JENKINSFILENAME=jenkins.war
    
    #停止方法
    stop(){
        echo "Stoping $JENKINSFILENAME "
    	ps -ef|grep $JENKINSFILENAME |awk '{print $2}'|while read pid
    	do
    	   kill -9 $pid
    	   echo " $pid kill"
    	done
    }
    
    case "$1" in
    start)
        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}
    ' "$prog"
      exit 1
      ;;
    esac

    保存为jenkins目录下 jenkins.sh

    JENKINS_ROOT为 jenkins目录

    1.centos

    ln -s /home/lanmps/jenkins/jenkins.sh /etc/init.d/jenkins
    chkconfig --add jenkins
    chkconfig --level 345 jenkins on
    启动方式
    /etc/init.d/jenkins start

    2.ubuntu

    ln -s /home/lanmps/jenkins/jenkins.sh /etc/init.d/jenkins
    update-rc.d -f jenkins defaults
    启动方式
    /etc/init.d/jenkins start
  • 相关阅读:
    TCP 连接状态
    可视化垃圾回收算法
    flume-ng+Kafka+Storm+HDFS 实时系统搭建
    WeX5 IDE 手机移动开发+JAVA +大数据
    云计算高级运维工程师
    CentOS 5.8 上安装 systemtap-2.6
    SYSTEMTAP -ORACLE
    Apple激活日期查询
    Div 浮动到另一个div之上
    Python模块常用的几种安装方式
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13318162.html
Copyright © 2011-2022 走看看