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