系統(tǒng)之家 - 系統(tǒng)光盤(pán)下載網(wǎng)站!

當(dāng)前位置:系統(tǒng)之家 > 系統(tǒng)教程 > Ubuntu更改jenkins端口號(hào)

在Ubuntu上更改jenkins端口號(hào)的方法

時(shí)間:2015-03-23 18:05:06 作者:qipeng 來(lái)源:系統(tǒng)之家 1. 掃描二維碼隨時(shí)看資訊 2. 請(qǐng)使用手機(jī)瀏覽器訪問(wèn): https://m.xitongzhijia.net/xtjc/20150323/42464.html 手機(jī)查看 評(píng)論

  Jenkins是一種持續(xù)集成工具,基于Java開(kāi)發(fā),在Ubuntu系統(tǒng)中,升級(jí)Jenkins的時(shí)候出現(xiàn)端口被占用的問(wèn)題,通過(guò)修改Jenkins端口號(hào)來(lái)解決這個(gè)問(wèn)題,下面小編就給大家介紹下Ubuntu如何修改Jenkins端口號(hào)吧。

 在Ubuntu上更改jenkins端口號(hào)的方法

  端口號(hào)是8080,另一個(gè)程序用到了8080,修改端口號(hào)不讓jenkins占用8080端口。

  通過(guò)檢查/etc/init.d/jenkins腳本,發(fā)現(xiàn)其實(shí)就需要做兩步:

  1. 修改do_start函數(shù)的check_tcp_port命令,端口號(hào)從8080換成8082

  #

  # 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

  然后重新啟動(dòng)jenkins, 檢查一下:

  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

  修改成功。

  上面就是Ubuntu更改Jenkins端口號(hào)的方法介紹了,只需兩步就可將Jenkins的端口號(hào)進(jìn)行修改,不會(huì)占用端口8080。

標(biāo)簽 Ubuntu

發(fā)表評(píng)論

0

沒(méi)有更多評(píng)論了

評(píng)論就這些咯,讓大家也知道你的獨(dú)特見(jiàn)解

立即評(píng)論

以上留言僅代表用戶個(gè)人觀點(diǎn),不代表系統(tǒng)之家立場(chǎng)

其他版本軟件

熱門(mén)教程

人氣教程排行

Linux系統(tǒng)推薦

掃碼關(guān)注
掃碼關(guān)注

掃碼關(guān)注 官方交流群 軟件收錄