Last active
February 5, 2025 19:24
-
-
Save kawaz/8c9bd7cf2d3aa42d4f54bf4fbd4d9573 to your computer and use it in GitHub Desktop.
サーバ再起動する際の起動前後で重要なプロセスの起動漏れとかマウント漏れとかがないかの確認を効率的にする為のメモ。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 再起動前のメモ | |
sudo bash -c "set -x; ps auxf; top -bn1; netstat -anp; mount; docker ps" > reboot2025.txt 2>&1 | |
# sudo shutdown -r now | |
# 再起動後に確認 | |
## 本当に再起動したか? | |
uptime | |
## netstat の比較 | |
diff <(cat reboot2025.txt|grep LISTEN|perl -pe's/\d+\///;s/\s\d+\s/ /g;s/[ \t]+/\t/g'|sort -V|perl -pe's/\d+\///;s/[ \t]+/\t/g') <(sudo netstat -anp|grep LISTEN|perl -pe's/\d+\///;s/\s\d+\s/ /g;s/[ \t]+/\t/g'|sort -V) | |
## mount 状態の比較 | |
diff <(cat reboot2025.txt|grep " on "|sort -k3) <(sudo mount|grep " on "|sort -k3) | |
## 再起動後に ftp 受信は来てるか? | |
sudo tail -F /var/log/pureftpd.log /var/log/xferlog | |
## 再起動後に http リクエストは来てるか? | |
sudo tail -F $(sudo find /var/log/httpd* -mmin -10 -type f) | |
## dockerコンテナの比較 | |
diff <(cat reboot2025.txt | awk '/^\+ docker ps/{f=1;next} /^#/{f=0} f'|sort -k2) <(docker ps|sort -k2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment