#!/bin/bash
cpu_idle=$(top -b -d 1 -n 2 | grep Cpu | awk 'NR>1{print $5}' | cut -f1 -d.)
if [ $cpu_idle -le 20 ]; then
pids=$(top -b -d 1 -n 1 | grep java | awk '{if($9 > 80) print $1}')
for pid in $pids; do
for ((a=1; a<10; a++)); do
date=$(date +%Y%m%d%H%M)
sh showstack.sh -c 30 -p $pid > log/stack_${pid}_${date}.log
jstat -gcutil $pid > log/gc_${pid}_${date}.log
done
jmap -heap $pid > log/heap_${pid}_${date}.log
done
fi
依賴工具:top, jstack(jcmd), jstat, jmap, showstack.sh (GitHub: oldratlee/useful-shells)。
whois.arin.net)。-NoForward 禁用)。# 域名查詢
Get-Whois dnspod.com
# 僅顯示權威結果,不跟隨轉發
Get-Whois jd.com -NoForward
# IP 查詢指定服務器
Get-Whois n 128.11.5.98 -Server whois.arin.net
Whois Server: 字段。/opt/scripts/,配置 crontab 定時運行或作為系統服務。$PROFILE 或模塊文件 Whois.psm1 自動加載。