status.sh 627 B

12345678910111213141516171819202122232425
  1. #!/usr/bin/env bash
  2. set -e
  3. cat << 'LOGO'
  4. ----------------------------------
  5. LOGO
  6. base_dir=$(
  7. cd "$(dirname "$0")"
  8. pwd
  9. )
  10. cd $base_dir
  11. server_pid=$(ps -auxc | grep minio-into-stck | grep -vE "grep|-Xmx700m" | awk '{print $2}')
  12. if [[ $server_pid == "" ]]; then
  13. echo "minio-into-stck 未在运行"
  14. else
  15. running_time=$(ps -o etime= -p "$server_pid")
  16. ports=$(ss -tnlp | grep minio-into-stck | awk '{print $4}')
  17. echo "minio-into-stck 当前PID: $server_pid"
  18. echo "当前运行时间: $running_time" | tr -s " "
  19. echo "当前运行端口:"
  20. for i in "$ports"; do
  21. echo "$i"
  22. break
  23. done
  24. fi