diff options
author | haturatu <taro@eyes4you.org> | 2024-09-22 18:17:14 +0900 |
---|---|---|
committer | haturatu <taro@eyes4you.org> | 2024-09-22 18:17:14 +0900 |
commit | 0981dfe8eef53544153274c885fe62773814f7b4 (patch) | |
tree | 41344ad2c918bc627ed7339c23f919101ead3624 /pnd.sh |
war pigs
Diffstat (limited to 'pnd.sh')
-rwxr-xr-x | pnd.sh | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -0,0 +1,25 @@ +#!/bin/bash + +# 必要なコマンドのリスト +commands=("grep" "awk" "df" "lsof" "sort" "uniq" "column") + +# コマンドの存在確認 +for cmd in "${commands[@]}"; do + if ! which "$cmd" > /dev/null 2>&1; then + echo "エラー: $cmd コマンドが見つかりません。" + exit 1 + fi +done + +# サーバー情報の出力 +echo -e "## CPU情報" +grep "model name" /proc/cpuinfo | head -1 + +echo -e "\n## メモリ情報" +awk '/MemTotal/ { printf "合計メモリ: %.2f GB\n", $2 / 1024 / 1024 }' /proc/meminfo + +echo -e "\n## ディスク使用量" +df -h + +echo -e "\n## リッスンポート" +lsof -i -P -n -l | grep "LISTEN" | awk '{print $1 "," $3 "," $9 "/" $8}' | sort | uniq | column -t -s "," |