123456789101112131415161718192021222324252627282930 |
- #!/usr/bin/env bash
- set -e
- cat << 'LOGO'
- ----------------------------------
- LOGO
- base_dir=$(
- cd "$(dirname "$0")"
- pwd
- )
- cd $base_dir
- BINARY_NAME="nsq-server"
- server_pid=$(pgrep -x $BINARY_NAME || true)
- if [[ $server_pid == "" ]]; then
- echo "nsq-server 未在运行"
- else
- for pid in $server_pid; do
- running_time=$(ps -o etime= -p "$pid")
- ports=$(ss -tnlp | grep $BINARY_NAME | awk '{print $4}')
- echo "nsq-server 当前PID: $pid"
- echo "当前运行时间: $running_time" | tr -s " "
- echo "当前运行端口:"
- for port in $ports; do
- echo "$port"
- break
- done
- done
- fi
|