Skip to content

Commit 3a55232

Browse files
committed
✨ 更新脚本
1 parent 36c501a commit 3a55232

14 files changed

Lines changed: 36 additions & 704 deletions

File tree

codes/demos/git/update-code.sh

Lines changed: 0 additions & 88 deletions
This file was deleted.

codes/deploy/main.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ function chooseOper() {
7979
nodejs) ${filepath}/tool/nodejs/install-nodejs.sh;;
8080
tomcat) ${filepath}/tool/tomcat/install-tomcat8.sh;;
8181
elk) ${filepath}/tool/elk/install-elk.sh;;
82-
* ) echo "invalid key";;
82+
* ) echo "${key} is invalid key";;
8383
esac
8484

8585
showMenu
Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
11
#!/bin/bash -li
22

3-
app=$1
4-
5-
ELASTICSEARCH_BIN_PATH=/opt/software/elastic/elasticsearch-6.1.1/bin
6-
LOGSTASH_BIN_PATH=/opt/software/elastic/logstash-6.1.1/bin
7-
KIBANA_BIN_PATH=/opt/software/elastic/kibana-6.1.1-linux-x86_64/bin
8-
FILEBEAT_PATH=/opt/software/elastic/filebeat-6.1.1-linux-x86_64
9-
10-
113
# 检查脚本输入参数
124
checkInput() {
13-
if [ "${app}" == "" ]; then
5+
if [ "${app}" == "" ] || [ "${oper}" == "" ]; then
146
echo "请输入脚本参数:name"
15-
echo " name: 要启动的进程关键字(必填)。可选值:elasticsearch|logstash|kibana|filebeat"
16-
echo "例:./shutdown.sh logstash"
7+
echo " app: 要启动的进程关键字(必填)。可选值:elasticsearch|logstash|kibana|filebeat"
8+
echo " oper: 执行操作(必填)。可选值:start|stop"
9+
echo "例:./boot-elk.sh logstash start"
1710
exit 0
1811
fi
1912

@@ -39,7 +32,7 @@ startup() {
3932
nohup sh ${ELASTICSEARCH_BIN_PATH}/elasticsearch >>${ELASTICSEARCH_BIN_PATH}/nohup.out 2>&1 &
4033
elif [ "${app}" == "logstash" ]; then
4134
checkFileExist ${LOGSTASH_BIN_PATH}/logstash
42-
nohup sh ${LOGSTASH_BIN_PATH}/logstash -f ${LOGSTASH_BIN_PATH}/logstash-input-tcp.conf >>${LOGSTASH_BIN_PATH}/nohup.out 2>&1 &
35+
nohup sh ${LOGSTASH_BIN_PATH}/logstash -f ${LOGSTASH_BIN_PATH}/logstash.conf >>${LOGSTASH_BIN_PATH}/nohup.out 2>&1 &
4336
elif [ "${app}" == "kibana" ]; then
4437
checkFileExist ${KIBANA_BIN_PATH}/kibana
4538
nohup sh ${KIBANA_BIN_PATH}/kibana >> ${KIBANA_BIN_PATH}/nohup.out 2>&1 &
@@ -50,6 +43,31 @@ startup() {
5043
fi
5144
}
5245

46+
shutdown() {
47+
pid=`ps -ef | grep java | grep ${app} | awk '{print $2}'`
48+
kill -9 ${pid}
49+
}
50+
5351
##############################__MAIN__########################################
52+
app=$1
53+
oper=$2
54+
55+
version=6.1.1
56+
ELASTICSEARCH_BIN_PATH=/opt/software/elastic/elasticsearch-${version}/bin
57+
LOGSTASH_BIN_PATH=/opt/software/elastic/logstash-${version}/bin
58+
KIBANA_BIN_PATH=/opt/software/elastic/kibana-${version}-linux-x86_64/bin
59+
FILEBEAT_PATH=/opt/software/elastic/filebeat-${version}-linux-x86_64
60+
5461
checkInput
55-
startup
62+
case ${oper} in
63+
start)
64+
echo "启动 ${app}"
65+
startup
66+
;;
67+
stop)
68+
echo "终止 ${app}"
69+
shutdown
70+
;;
71+
* ) echo "${oper} is invalid oper";;
72+
esac
73+
File renamed without changes.

codes/deploy/tool/elk/install-elk.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ replaceLogstashConfig() {
9191
sed -i "s/# http.host: \"127.0.0.1\"/ http.host: ${IP}/g" ${ELASTIC_SOFTWARE_PATH}/logstash-${version}/config/logstash.yml
9292
touch ${ELASTIC_SOFTWARE_PATH}/logstash-${version}/bin/nohup.out
9393
cd ${ELASTIC_SOFTWARE_PATH}/logstash-${version}/bin
94-
wget https://github.com/dunwu/linux-notes/blob/master/codes/deploy/tool/elk/config/logstash-input-tcp.conf
94+
wget https://github.com/dunwu/linux-notes/blob/master/codes/deploy/tool/elk/config/logstash.conf
9595
}
9696

9797
# 替换 Kibana 配置
@@ -138,5 +138,8 @@ replaceKibanaConfig
138138
installFilebeat
139139
replaceFilebeatConfig
140140

141+
# 最后,将启动脚本下载到本地
142+
mkdir -p /home/zp/script
143+
wget -P /home/zp/script "https://raw.githubusercontent.com/dunwu/linux/master/codes/deploy/tool/elk/boot-elk.sh"
141144
#setPrivilegeForUser
142145

codes/olddeploy/README.md

Lines changed: 0 additions & 4 deletions
This file was deleted.

codes/olddeploy/deployment.sh

Lines changed: 0 additions & 167 deletions
This file was deleted.

0 commit comments

Comments
 (0)