设置参数
General -> 参数化构建过程 -> Add Parameter -> 选项参数
- Name:
operate - Choices:
start
stop
参数取值
cd deploy/appblog-elastalert
sh ./deploy.sh ${operate}
#!/bin/bash
pid=`ps -ef | grep python | grep elastalert | awk '{print $2}'`
echo $pid
echo $1
if [ $1 == 'start' ]; then
if [ -n "$pid" ]; then
kill -9 $pid
fi
nohup python -m elastalert.elastalert --start NOW --verbose --rule /home/appblog/elastalert/appblog.yaml --config /home/appblog/elastalert/config.yaml > /dev/null 2>&1 &
elif [ $1 == 'stop' ]; then
if [ -n "$pid" ]; then
kill -9 $pid
fi
fi