#!/bin/bash

# 这里 grep -vE 必须有, 否则会杀死全部进程..
pids=`ps -ef | grep 'prometheus'|  grep -vE '(grep|/bin/bash|bash|sh)' | tr -s ' '| cut -d ' ' -f 2`
echo "进程 id"
pids=(${pids// / })  

echo $pids
pid=${pids}
for var in ${pids[@]};do
echo $var
done
if [ $pid ]
then
    echo "执行 ‘kill $pid’ "
    kill $pid
fi

cd /usr/prometheus
nohup ./prometheus --config.file=prometheus.yml > /dev/null &
echo '重启 prometheus 成功'
exit 0

  

相关文章:

  • 2021-07-02
  • 2022-02-22
  • 2022-12-23
  • 2021-12-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-06
  • 2021-06-08
  • 2022-12-23
  • 2022-12-23
  • 2021-07-09
  • 2022-02-26
  • 2021-11-11
相关资源
相似解决方案