zoukankan      html  css  js  c++  java
  • 【Jenkins】修改Ubuntu下的jenkins端口号

    jenkins安装目录:/var/lib/jenkins 
    jenkins日志目录:/var/log/jenkins/jenkins.log
    jenkins默认配置:/etc/default/jenkins
     
    通过检查/etc/init.d/jenkins脚本,发现其实就需要做两步:
    1. 修改do_start函数的check_tcp_port命令,端口号从8080换成8082
    [plain] 
    #                                                                                                                                                                                                                      
    # Function that starts the daemon/service                                                                                                                                                                              
    #                                                                                                                                                                                                                      
    do_start()  
    {  
        # the default location is /var/run/jenkins/jenkins.pid but the parent directory needs to be created                                                                                                                
        mkdir `dirname $PIDFILE` > /dev/null 2>&1 || true  
        chown $JENKINS_USER `dirname $PIDFILE`  
        # Return                                                                                                                                                                                                           
        #   0 if daemon has been started                                                                                                                                                                                   
        #   1 if daemon was already running                                                                                                                                                                                
        #   2 if daemon could not be started                                                                                                                                                                               
        $DAEMON $DAEMON_ARGS --running && return 1  
      
        # Verify that the jenkins port is not already in use, winstone does not exit                                                                                                                                       
        # even for BindException                                                                                                                                                                                           
        check_tcp_port "http" "$HTTP_PORT" "8082" || return 1  
      
        # If the var MAXOPENFILES is enabled in /etc/default/jenkins then set the max open files to the                                                                                                                    
        # proper value                                                                                                                                                                                                     
        if [ -n "$MAXOPENFILES" ]; then  
            [ "$VERBOSE" != no ] && echo Setting up max open files limit to $MAXOPENFILES  
            ulimit -n $MAXOPENFILES  
        fi  
      
        # --user in daemon doesn't prepare environment variables like HOME, USER, LOGNAME or USERNAME,                                                                                                                     
        # so we let su do so for us now                                                                                                                                                                                    
        $SU -l $JENKINS_USER --shell=/bin/bash -c "$DAEMON $DAEMON_ARGS -- $JAVA $JAVA_ARGS -jar $JENKINS_WAR $JENKINS_ARGS" || return 2  
    }  
     
    2.修改/etc/default/jenkins文件,将端口8080改成8082
     
    然后重新启动jenkins, 检查一下:
    [plain] 
    ps -def | grep java  
    jenkins   7234  7233 99 11:14 ?        00:00:04 /usr/bin/java -jar /usr/share/jenkins/jenkins.war --webroot=/var/cache/jenkins/war --httpPort=8082 --ajp13Port=-1  
  • 相关阅读:
    [LeetCode] 875. Koko Eating Bananas 科科吃香蕉
    [LeetCode] 874. Walking Robot Simulation 走路机器人仿真
    [LeetCode] 995. Minimum Number of K Consecutive Bit Flips 连续K位翻转的最小次数
    [LeetCode] 873. Length of Longest Fibonacci Subsequence 最长的斐波那契序列长度
    [LeetCode] 872. Leaf-Similar Trees 叶结点相似的树
    [LeetCode] 870. Advantage Shuffle 优势洗牌
    [LeetCode] 869. Reordered Power of 2 重新排序为2的倍数
    [LeetCode] 868. Binary Gap 二进制间隙
    [LeetCode] 867. Transpose Matrix 转置矩阵
    [LeetCode] 866. Prime Palindrome 质数回文数
  • 原文地址:https://www.cnblogs.com/chenxiaomeng/p/11412038.html
Copyright © 2011-2022 走看看