LoginSignup
4
3

More than 1 year has passed since last update.

【Linux】現地調査用情報収集スクリプト

Last updated at Posted at 2022-12-11

Linuxサーバの情報収集用シェルスクリプト

gathering.sh
#!/bin/bash

TODAY=`date +%Y%m%d`
#INTERVAL="3"

command_list(){
        ps aux
        sysctl -a
        rpm -qa
        systemctl list-unit-files --type service | cat
        uname -a
        cat /etc/redhat-release
        systemctl get-default
        cat /etc/passwd
        cat /etc/group
        cat /etc/shadow
        ls -al /home/
        ls -al /var/spool/mail/
        date
        timedatectl show
        chronyc sources
        cat /etc/chrony.conf
        cat /etc/nsswitch.conf
        env
        cat /etc/environment
        getenforce
        systemctl status firewalld
        ls -al /etc/skel/
        ip addr
        cat /etc/resolv.conf
        cat /etc/hosts
        netstat -tupnl
        ss -tupnl
        ping -c 3 8.8.8.8
        nslookup google.com
        cat /etc/fstab
        mount
        df -h
        lsblk
        blkid
        fdisk -l
        du -hc /home/
        du -hc /var/
        du -hc /etc/
        kill -9 $$
}

while true;
do
        command_list 1>> result_${TODAY}.log 2>> error_${TODAY}.log
#       sleep ${INTERVAL}
done
4
3
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
3