1、運行程式報錯:
FailFast: Couldn't find a valid ICU package installed on the system.
解決方法:
yum install icu -y
2、程式運行后,本地可以訪問,但其他機器無法訪問,需要開放埠
firewall-cmd --add-port=8080/tcp --permanent #開啟tcp的8080埠
firewall-cmd --add-port=9800/udp --permanent #開啟udp的9800埠
firewall-cmd --reload #重新加載防火墻規則
查看tcp的8080埠是否開放:firewall-cmd --query-port=8080/tcp yes為已開放,no為未開放
3、程式需要用戶登出后繼續運行,使用命令nohup和&
例如:nohup command > myout.file 2>&1 &
在上面的例子中,0 – stdin (standard input),1 – stdout (standard output),2 – stderr (standard error) ; 2>&1是將標準錯誤(2)重定向到標準輸出(&1),標準輸出(&1)再被重定向輸入到myout.file檔案中& : 指在后臺運行
nohup : 不掛斷的運行,注意并沒有后臺運行的功能,,就是指,用nohup運行命令可以使命令永久的執行下去,和用戶終端沒有關系,例如我們斷開SSH連接都不會影響他的運行
4、給腳本檔案添加權限(其他用戶無寫入權限)
chmod 775 tesh.sh
5、tar命令的壓縮和解壓命令
壓縮:tar zcvf FileName.tar.gz DirName
壓縮指定的檔案夾,但排出某些檔案:
tar zcvf data.tar.gz --exclude-from /data/Excludefile /data/web/
解壓:tar zxvf FileName.tar.gz
6、通過腳本重啟應用
PID=`ps -ef | grep ${APP_NAME} | grep -v grep | awk '{print $2}'`
echo ${PID}
if test -z ${PID}
then
echo "app not start."
else
echo "will shutdown app"
kill -9 ${PID}
sleep 2
fi
nohup ${APP_HOME}/${APP_NAME} > ${APP_HOME}/catalina.out 2>&1 &
7、添加腳本,開機自動啟動服務
1)添加執行權限到檔案 /etc/rc.d/rc.local
chmod +x /etc/rc.d/rc.local
2) 添加啟動腳本到檔案 rc.local
如:echo "/usr/local/start.sh" >> rc.local
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/24078.html
標籤:.NET Core
