You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
1.7 KiB
63 lines
1.7 KiB
#!/bin/bash
|
|
#set -x
|
|
set -e
|
|
|
|
echoPrefix="\033[36m+"
|
|
echoSuffix="\033[0m"
|
|
|
|
installPath=/home/opt/kibana/kibana-7.17.5-linux-x86_64
|
|
serverName=test_kibana
|
|
cmd=$1
|
|
|
|
startServer() {
|
|
pid=$1
|
|
if [ -z $pid ];then
|
|
echo -e "$echoPrefix cd $installPath/bin $echoSuffix"
|
|
cd $installPath/bin
|
|
echo -e "$echoPrefix nohup ./kibana >>/dev/null 2>&1 & $echoSuffix"
|
|
nohup ./kibana >>/dev/null 2>&1 &
|
|
echo "$serverName 启动成功!"
|
|
else
|
|
echo "$serverName 正在运行..."
|
|
fi
|
|
}
|
|
|
|
stopServer() {
|
|
pid=$1
|
|
if [ -z $pid ];then
|
|
echo "$serverName 未运行"
|
|
else
|
|
echo -e "$echoPrefix ps -ef | grep './../node/bin/node ./../src/cli/dist' | grep -v 'grep' | awk '{print \$2}' | xargs kill $echoSuffix"
|
|
ps -ef | grep "./../node/bin/node ./../src/cli/dist" | grep -v 'grep' | awk '{print $2}' | xargs kill
|
|
echo "$serverName 已停止!"
|
|
fi
|
|
}
|
|
|
|
restartServer() {
|
|
pid=$1
|
|
if [ ! -z $pid ];then
|
|
stopServer $pid
|
|
sleep 3s
|
|
fi
|
|
startServer
|
|
}
|
|
|
|
pid=`ps -ef | grep "./../node/bin/node ./../src/cli/dist" | grep -v 'grep' | awk '{print $2}'`
|
|
# 操作参数: restart start stop kill
|
|
if [ "$cmd" == "restart" ];then
|
|
restartServer $pid
|
|
elif [ "$cmd" == "start" ];then
|
|
startServer $pid
|
|
elif [ "$cmd" == "stop" ] || [ "$cmd" == "kill" ];then
|
|
stopServer $pid
|
|
else
|
|
if [ -z $pid ];then
|
|
echo "$serverName 未运行 | 输入操作参数: restart start stop kill"
|
|
echo "日志目录: cd $installPath/logs"
|
|
else
|
|
echo "输入操作参数: restart start stop kill"
|
|
echo "pid=$pid | $serverName 正在运行... | 日志目录: cd $installPath/logs"
|
|
fi
|
|
fi
|
|
|
|
# bash <(curl -s http://git.yvanui.com/lizhiwei/jztd-deploy/raw/master/00base/05kibana.sh) [cmd]
|
|
|