linux-tutorial/codes/olddeploy/elk/shutdown.sh
2018-02-01 16:34:02 +08:00

28 lines
715 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash -li
app=$1
checkInput() {
if [ "${app}" == "" ]; then
echo "请输入脚本参数name"
echo " name: 要终止的进程关键字必填。可选值elasticsearch|logstash|kibana|filebeat"
echo "例:./shutdown.sh logstash"
exit 0
fi
if [ "${app}" != "elasticsearch" ] && [ "${app}" != "logstash" ] && [ "${app}" != "kibana" ] && [ "${app}" != "filebeat" ]; then
echo "name 输入错误"
echo "可选值elasticsearch|logstash|kibana|filebeat"
exit 0
fi
}
shutdown() {
PID=`ps -ef | grep ${app} | awk '{ print $2}' | head -n 1`
kill -9 ${PID}
}
##############################__MAIN__########################################
checkInput
shutdown