12345678910111213141516171819202122232425 |
- #!/usr/bin/env bash
- set -e
- cat << 'LOGO'
- ----------------------------------
- LOGO
- base_dir=$(
- cd "$(dirname "$0")"
- pwd
- )
- cd $base_dir
- pid=$(ps -auxc | grep grafana | grep -vE "grep|-Xmx700m" | awk '{print $2}')
- if [[ $pid == "" ]]; then
- echo "grafana未在运行"
- else
- running_time=$(ps -o etime= -p "$pid")
- ports=$(netstat -tnlp | grep graf. | head -n +1 | awk '{print $4}')
- echo "grafana当前PID: $pid"
- echo "当前运行时间: $running_time" | tr -s " "
- echo "当前运行端口:"
- for i in "$ports"; do
- echo "$i"
- done
- fi
- echo -e "\n"
|