-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsystem_discovery_script.bash
More file actions
78 lines (63 loc) · 1.08 KB
/
Copy pathsystem_discovery_script.bash
File metadata and controls
78 lines (63 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/bash
#filename: system_discovery_script.bash
#description: basis system discovery script
myhost=`uname -a | awk {'print $2'}`
function my_header {
echo
echo
echo "*************************************"
echo $TITLE $myhost
echo "*************************************"
echo
}
REDHAT=0
if [ -e /etc/redhat-release ];then
TITLE="RED HAT RELEASE"
REDHAT=1 #set redhat machine
my_header
cat /etc/redhat-release
fi
IP="/usr/sbin/ip"
TITLE="IP ROUTE "
my_header
if [ -e $IP ]; then
$IP route
TITLE="IP ADDRESS"
my_header
$IP addr
else
echo "*old machine*"
netstat -r
TITLE="IP ADDRESS"
my_header
/sbin/ifconfig -a
fi
HOSTS="/etc/hosts"
if [ -e $HOSTS ]; then
TITLE="HOSTS FILE"
my_header
cat $HOSTS
fi
TITLE="DISK SPACE"
my_header
df -h
TITLE="DISK INODES"
my_header
df -i
TITLE="UPTIME"
my_header
uptime
TITLE="PROCESSES"
my_header
ps aux
TITLE="MESSAGES"
dmesg
TITLE="PACKAGES INSTALLED"
if [ $REDHAT -eq 1 ]; then
P_COUNT=`rpm -qa| wc -l`
my_header
rpm -qai
#$RPM_PATH -qai
TITLE="$P_COUNT $TITLE"
my_header
fi