File: system

package info (click to toggle)
sitesummary 0.1.61
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 580 kB
  • sloc: perl: 1,929; sh: 805; makefile: 86
file content (103 lines) | stat: -rw-r--r-- 2,518 bytes parent folder | download
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/sh

PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/usr/local/bin

# Keep going even if one of the programs report an error code
# set -e

mkdir system && cd system

if type dmidecode >/dev/null 2>&1; then
    # Throw away error messages.  It will print "/dev/mem: mmap: Bad address"
    # in Xen machines.
    dmidecode   > dmidecode 2> /dev/null
fi

if [ -d /proc/bus/pci ] && [ -n "${ENABLE_LSPCI}" ] && type lspci >/dev/null 2>&1; then
    lspci       > lspci
    lspci -n    > lspci-n
fi

if type lsusb >/dev/null 2>&1; then
    lsusb       > lsusb
fi

if [ -d /sys/bus/scsi ] && type lsscsi >/dev/null 2>&1; then
    lsscsi       > lsscsi
fi

if type lsmod >/dev/null 2>&1; then
    lsmod       > lsmod
fi

uname -smr  > uname-smr
uname -n    > hostname
ifconfig -a > ifconfig-a
route -n    > route-n
cat /proc/cpuinfo > cpuinfo
cat /proc/meminfo > meminfo

# Collect software RAID status
if [ -f /proc/mdstat ] ; then
    cat /proc/mdstat > mdstat
fi

# Collect hard disk information
for diskdev in $(grep 'sd.$' /proc/partitions|awk '{print $4}'|sort); do
    hdparm -I /dev/$diskdev 2>/dev/null || true
done > hdparm-I

# Collect zfs hard disk information too
if type zpool >/dev/null 2>&1 ; then
   zpool status > zpool-status
fi

# Collect mount points, for nagios configuration
cp /etc/fstab fstab
cat /proc/mounts > procmounts

# Document current runlevel, useful to differenciate LTSP
# thin clients from diskless workstations.
if command -v runlevel >/dev/null 2>&1; then
    runlevel > runlevel
fi

if command -v systemctl >/dev/null 2>&1 && [ -d /run/systemd/system ]; then
    systemctl list-units --type=target --state=active > systemd-targets
fi

# Throw away error message from laptop-detect using dmidecode in Xen
# domUs.  See #438693 for more info.
if [ -x /usr/sbin/laptop-detect ] && /usr/sbin/laptop-detect 2>/dev/null; then
    touch laptop
fi

for f in /etc/ssh/ssh_host*.pub ; do
    cp $f .
done

if [ -f /etc/X11/xorg.conf ]; then
    cp /etc/X11/xorg.conf .
fi

if [ -f /var/log/Xorg.0.log ]; then
    cp /var/log/Xorg.0.log .
fi

if [ -f /etc/X11/fs/config ]; then
    cp /etc/X11/fs/config x11-fs-config
fi

# Collect Cisco Discover Protocol information from all interfaces, in
# parallell.
if type cdpr >/dev/null 2>&1; then
    childs=""
    for if in $(ip link show up|awk '/^[0-9]+:/ {print $2}' | cut -d: -f1) ; do
	if [ lo = "$if" ] ; then continue; fi
	cdpr -d $if -t 61 > cdpr.$if &
	childs="$childs $!"
    done
    for pid in $childs ; do
	wait $pid
    done
fi