伺服器端 jetty 自動部署指令碼

2021-09-08 13:00:58 字數 1964 閱讀 2276

乙個伺服器端jetty容器自動備份和發版的指令碼,已使用與生產環境。可整合到jenkins中實現打包後自動備份發版。

檔案:publish.sh

#!/bin/sh

server_ip=`ifconfig |grep inet|grep -v 127.0.0.1|grep -v inet6|awk ''|tr -d "addr:"`

log_home=/opt/logs

war_home=/opt/deploy/warfiles

now_time=$(date +%y%m%d%h%m)

bak_dir=last

suffix='['$war_name']['$server_ip']'

echo $suffix compare old file and new file size

old_file_size=0

fi new_file_size=`du -b $war_home/$war_name.war | awk '' `

if [ $old_file_size -ne $new_file_size ]

then

echo $suffix file has changed, should redeploy $war_name service

echo $suffix step 1. backup last backup file to $war_name.war_$now_time

fiif [ -f $war_name.war ];then

mv $war_name.war $war_name.war_$now_time

ficp $war_home/$war_name.war ./$war_name.war

echo $suffix step 4. restart jetty service...

cd $jetty_home/bin

sh ./jetty.sh restart >/dev/null 2>&1

else

echo $suffix file not changed, skip redeploy steps

fiecho $suffix deploy success

回滾指令碼:roll_back.sh

#!/bin/sh

server_ip=`ifconfig |grep inet|grep -v 127.0.0.1|grep -v inet6|awk ''|tr -d "addr:"`

log_home=/opt/logs

now_time=$(date +%y%m%d%h%m)

bak_dir=last ##備份檔案夾

suffix='['$war_name']['$server_ip']'

echo $suffix compare backup file and current file size

backup_file_size=0

echo $suffix no backup file found, rollback finished unsuccessfully!

exit

else

fiif [ $backup_file_size -ne $current_file_size ]

then

echo $suffix file has changed, should rollback $war_name service

echo $suffix step 2. restart jetty service...

cd $jetty_home/bin

sh ./jetty.sh restart >/dev/null 2>&1

else

echo $suffix file not changed, skip redeploy steps

fiecho $suffix deploy success

伺服器端註冊客戶端指令碼

附上測試 測試 1public partial class 後台註冊指令碼 system.web.ui.page 2 7 region showmsg 8protected void showmsg string msg 9 1213 protected void showmsg2 string m...

一 Nagios 部署伺服器端記錄

nagios是什麼?我也不小得.你小得不?你也不小得啊?那算了,你別看了,我也不寫了.下面是安裝步驟 一 install lamp環境 這個是必需的,由於我的輸入法大小寫切換不便,所以後面的nagios一律寫成nagios 具體安裝方法請參考其它高人寫的高階點的文件,我就不寫了.哎呀,真是廢話多.不...

Vue Ionic 部署到伺服器端隨筆

1.構建該專案原始碼 到專案路徑下執行 cnpm run build在專案根目錄下執行以上命令,會在專案根目錄下生成 dist 資料夾。2.部署編譯後檔案 將專案目錄複製到伺服器的nginx tomcat iis apache等工作目錄下 3.訪問web伺服器端口 訪問web伺服器的相應路徑即可訪問...