1. 程式人生 > >ubuntu 16.04 Jenkins 更改埠和改變語言設定

ubuntu 16.04 Jenkins 更改埠和改變語言設定

使用ubuntu apt 安裝jenkins 預設的埠是8080 

此埠和tomcat的埠一般會有衝突,tomcat的埠一般就不太會改。

我們就來改一下jenkins的埠來解決這個問題。

一般我們apt 安裝的服務 都會再/etc/init.d/下有啟動檔案。

找到/etc/init.d/jenkins

查詢得知以下常用的資訊:

pid:/var/run/jenkins/jenkins.pid

啟動一般是守護的

預設配置檔案在/etc/default/jenkins下

預設語言檔案:/etc/default/locale

埠的更改可以再/etc/default/jenkins裡找到8080  更改成你想設定的那個。

然後重啟服務

sudo service jenkins restart

即可。

而jenkins的語言設定是根據/etc/default/locale

你可以在此檔案 或者 啟動腳本里更改此選項 來更換語言顯示;建議改指令碼而不是改locale  ,因為更改locale會影響ubuntu的系統顯示

更方便的修改顯示語言的方法是瀏覽器中設定瀏覽器的語言顯示,這樣jenkins的web也會根據此設定來顯示具體的語言,不再演示。

貼出jenkins指令碼:

#!/bin/bash
# /etc/init.d/jenkins
# debian-compatible jenkins startup script.
# Amelia A Lewis <[email protected]
> # ### BEGIN INIT INFO # Provides: jenkins # Required-Start: $remote_fs $syslog $network # Required-Stop: $remote_fs $syslog $network # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start Jenkins at boot time # Description: Controls Jenkins Continuous Integration Server ### END INIT INFO PATH=/bin:/usr/bin:/sbin:/usr/sbin DESC="Jenkins Continuous Integration Server" NAME=jenkins SCRIPTNAME=/etc/init.d/$NAME [ -r /etc/default/$NAME ] && . /etc/default/$NAME #DAEMON=$JENKINS_SH DAEMON=/usr/bin/daemon DAEMON_ARGS="--name=$NAME --inherit --env=JENKINS_HOME=$JENKINS_HOME --output=$JENKINS_LOG --pidfile=$PIDFILE" if [ -n "$UMASK" ]; then DAEMON_ARGS="$DAEMON_ARGS --umask=$UMASK" fi SU=/bin/su # Exit if the package is not installed if [ ! -x "$DAEMON" ]; then echo "daemon package not installed" >&2 exit 1 fi # Exit if not supposed to run standalone if [ "$RUN_STANDALONE" = "false" ]; then echo "Not configured to run standalone" >&2 exit 1 fi # load environments if [ -r /etc/default/locale ]; then . /etc/default/locale export LANG LANGUAGE elif [ -r /etc/environment ]; then . /etc/environment export LANG LANGUAGE fi # Load the VERBOSE setting and other rcS variables . /lib/init/vars.sh # Define LSB log_* functions. # Depend on lsb-base (>= 3.0-6) to ensure that this file is present. . /lib/lsb/init-functions # Make sure we run as root, since setting the max open files through # ulimit requires root access if [ `id -u` -ne 0 ]; then echo "The $NAME init script can only be run as root" exit 1 fi check_tcp_port() { local service=$1 local assigned=$2 local default=$3 if [ -n "$assigned" ]; then port=$assigned else port=$default fi count=`netstat --listen --numeric-ports | grep \:$port[[:space:]] | grep -c . ` if [ $count -ne 0 ]; then echo "The selected $service port ($port) seems to be in use by another program " echo "Please select another port to use for $NAME" return 1 fi } # # 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" "8080" || return 2 # 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 # notify of explicit umask if [ -n "$UMASK" ]; then [ "$VERBOSE" != no ] && echo Setting umask to $UMASK 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 } # # Verify that all jenkins processes have been shutdown # and if not, then do killall for them # get_running() { return `ps -U $JENKINS_USER --no-headers -f | egrep -e '(java|daemon)' | grep -c . ` } force_stop() { get_running if [ $? -ne 0 ]; then killall -u $JENKINS_USER java daemon || return 3 fi } # Get the status of the daemon process get_daemon_status() { $DAEMON $DAEMON_ARGS --running || return 1 } # # Function that stops the daemon/service # do_stop() { # Return # 0 if daemon has been stopped # 1 if daemon was already stopped # 2 if daemon could not be stopped # other if a failure occurred get_daemon_status case "$?" in 0) $DAEMON $DAEMON_ARGS --stop || return 2 # wait for the process to really terminate for n in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do sleep 1 $DAEMON $DAEMON_ARGS --running || break done if get_daemon_status; then force_stop || return 3 fi ;; *) force_stop || return 3 ;; esac # Many daemons don't delete their pidfiles when they exit. rm -f $PIDFILE return 0 } # Verify the process did in fact start successfully and didn't just bomb out do_check_started_ok() { sleep 1 if [ "$1" -ne "0" ]; then return $1; fi get_running if [ "$?" -eq "0" ]; then return 2 else return 0 fi } case "$1" in start) log_daemon_msg "Starting $DESC" "$NAME" do_start START_STATUS="$?" do_check_started_ok "$START_STATUS" case "$?" in 0|1) log_end_msg 0 ;; 2) log_end_msg 1 ; exit 7 ;; esac ;; stop) log_daemon_msg "Stopping $DESC" "$NAME" do_stop case "$?" in 0|1) log_end_msg 0 ;; 2) log_end_msg 1 ; exit 100 ;; esac ;; restart|force-reload) # # If the "reload" option is implemented then remove the # 'force-reload' alias # log_daemon_msg "Restarting $DESC" "$NAME" do_stop case "$?" in 0|1) do_start START_STATUS="$?" sleep 1 do_check_started_ok "$START_STATUS" case "$?" in 0) log_end_msg 0 ;; 1) log_end_msg 1 ; exit 100 ;; # Old process is still running *) log_end_msg 1 ; exit 100 ;; # Failed to start esac ;; *) # Failed to stop log_end_msg 1 ;; esac ;; status) get_daemon_status case "$?" in 0) echo "$DESC is running with the pid `cat $PIDFILE`" rc=0 ;; *) get_running procs=$? if [ $procs -eq 0 ]; then echo -n "$DESC is not running" if [ -f $PIDFILE ]; then echo ", but the pidfile ($PIDFILE) still exists" rc=1 else echo rc=3 fi else echo "$procs instances of jenkins are running at the moment" echo "but the pidfile $PIDFILE is missing" rc=0 fi exit $rc ;; esac ;; *) echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2 exit 3 ;; esac exit 0


相關推薦

ubuntu 16.04 Jenkins 更改改變語言設定

使用ubuntu apt 安裝jenkins 預設的埠是8080  此埠和tomcat的埠一般會有衝突,tomcat的埠一般就不太會改。 我們就來改一下jenkins的埠來解決這個問題。 一般我們apt 安裝的服務 都會再/etc/init.d/下有啟動檔案。 找到/et

ubuntu 16.04 安裝Tensorflow(CPUGPU)

一、ubuntu 16.04 安裝Tensorflow(CPU) 1、安裝pip       開啟終端輸入命令:sudo apt-get install python-pip python-dev 2、安裝tensorflow    

ubuntu 16.04 原始碼安裝httpdphp

ubuntu 16.04 原始碼安裝httpd和php 在對httpd和php進行編譯時,需要提前安裝一些依賴包,請先完整的閱讀本篇文章,把本人遇到的一些問題依賴問題解決好再進行操作! 1. 原始碼安裝httpd 安裝apr wget http

ubuntu 16.04下安裝torchtorchvision

[email protected]:~$ pip install /home/frank/torch-0.4.1-cp35-cp35m-linux_x86_64.whl Processing

ubuntu 16.04 安裝Numix Theme Icons

感想 最近在使用ubuntu 的時候,意外的看見了還有很好看的ubuntu desktop主題,於是學習了一下,發現確實比以前好看多了,我這裡也分享一下命令列教程: 安裝Unity Tweak Tool sudo apt-get install unity-tweak-tool

Ubuntu 16.04繫結anaconda3anaconda2

1.開啟終端並輸入: sudo gedit  ~/.bashrc   2.在.bashrc檔案末尾新增:(路徑換成自己的) export PATH=/home/pico/anaconda3/bin:$PATH  然後儲存,關閉檔案  3

如何在Ubuntu 16.04上安裝SwiftVapor

介紹 Swift是Apple開發的一種程式語言,特點是快,安全和現代化,它有一個支援語言的龐大社群。Swift主要用於開發iOS和Mac OS應用程式,但從Swift 3開始,您也可以將其用於伺服器端應用程式開發。 Vapor是一個流行的伺服器端Swif

Ubuntu 16.04 下機器學習人工智慧的環境安裝(較詳盡)

為什麼用Ubuntu?         ubuntu是目前最為流行的linux的發行版,安裝簡單,視覺化,傻瓜化。目前的相關社群也比較完善,網上資料豐富,是新手上手linux環境下開發比較不錯的一個版本。         ubuntu目前一般每隔兩年會發行一版LTS版本,

Ubuntu 16.04下安裝zshoh-my-zsh

注意:安裝前先備份/etc/passwd 一開始裝oh-my-zsh我是拒絕的,因為這東西安裝容易,解除安裝難,真的很難。 說明:Ubuntu下預設沒有安裝zsh,Mac下預設安裝了zsh。 注意:安裝了oh-my-zsh之後的環境變數入口就會從./bashrc變成./zshrc,這點在配置環境

ubuntu 16.04 安裝 eclipse教程總結

主要參考以下幾個教程,並在這些教程基礎上,修改一些個人遇到的問題: 1.下載jdk , 我選的版本是:jdk-8u151-linux-x64.tar.gz  3.將jdk解壓到 /opt/資料夾中(資料夾可以自選) 操作步驟: sudo tar zxvf j

ubuntu 16.04 配置Python2.7 Python3.5 同時呼叫OpenCV

參考https://blog.csdn.net/jiandanjinxin/article/details/71438780 其中有改動;sudo apt-get -y install libtiff4-dev 改為sudo apt-get -y instal

Ubuntu 16.04更改mysql預設編碼

預設的 mysql編碼 不是utf8 因此想到要改成utf8 以支援中文 my.cnf 這個配置檔案如果為空或不存在的時候mysql採用預設配置執行,這個沒有多大關係。 如果你需要做相關配置則可以拷貝任意一個配置檔案到/etc目錄下,然後根據你的實際需要進行修改就可以了。

ubuntu 16.04下編譯androidlinux版webrtc

checkout rec ppr 這一 腳本 -- pytho 新源 alex 1. 安裝幹凈的ubuntu 16.04 x86_64位版本 2. 使用apt-get安裝git和Python2.7 3. 下載depot_tools(https://storage.goo

ubuntu 16.04 英文版命令列安裝中文語言

language-pack-af language-pack-gnome-ka language-pack-kde-pl language-pack-af-base language-pack-gnome-ka-base

Ubuntu 16.04.2 LTS 安裝 jdk1.6 tomcat6 (二)

pass set 命令 arc 記錄 variable ogr ant pat 上一篇記錄和分享了jdk1.6 在Ubuntu 16.04.2 環境下的安裝配置,本文開始安裝和配置tomcat 6 2 安裝tomcat http://tomcat.ap

ubuntu 16.04安裝pip、pip3、ipythonipython3

ubuntu 16.04 安裝 pip ipython pip3 ipython3 在ubuntu 16.04 server版上安裝pip、pip3、ipython2和ipython3具體步驟如下:[email protected]:~$ sudo apt install p

ubuntu 16.04安裝nVidia顯卡驅動cuda/cudnn踩坑過程

頭文件 技術 mode black ubun 沖突 bash 更新 linu 安裝深度學習框架需要使用cuda/cudnn(GPU)來加速計算,而安裝cuda/cudnn,首先需要安裝nvidia的顯卡驅動。 我在安裝的整個過程中碰到了驅動沖突,循環登錄兩個問題,以至於

基於Ubuntu Server 16.04 LTS版本安裝部署Django之(四):安裝MySQL數據庫

ins cli 遠程訪問 lib root 版本 連接 str ibm 1.安裝mysql以及插件: sudo apt-get install mysql-server mysql-client sudo apt-get install libmysqld-devsud

ubuntu 16.04 python版本切換(python2python3)

csdn ati hang -a .net http 6.0 python2 https sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 100 sudo update-

Ubuntu 16.04 文件服務器--samba的安裝配置

放置 chmod 免費 update 執行 訪問服務器 ubuntu 並保存 虛擬 參考:http://one.ifof1.cn/ Samba是在Linux系統上實現的SMB(Server Messages Block,信息服務塊)協議的一款免費軟件。它實現在局域網內共享文