-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcommand_out.sh
executable file
·64 lines (45 loc) · 1.15 KB
/
command_out.sh
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
#!/bin/bash
# Shatadru Bandyopadhyay
# https://github.com/shatadru/SGPD/
# Collects command outputs
host="$(hostname)"
# Creating temporary directory to save the files
tempdirname=`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 10 | head -n 1`
mkdir /tmp/$tempdirname/
DIR=/tmp/$tempdirname
cd $DIR
FILENAME="command_outputs-$host-$(date +%d%m%y_%H%M%S).tar"
#### Commands to Run #####
# system Info
date &> date
uname -a &> uname
echo $host &> hostname
# lvm
mkdir -p etc
mkdir -p etc/lvm
cat /etc/lvm/lvm.conf > etc/lvm/lvm.conf
lvs -o +devices &> lvs
vgs -o +devices &> vgs
pvs &> pvs
lvdisplay &> lvdisplay
vgdisplay &> vgdisplay
pvdisplay &> pvdisplay
# device mapper
dmsetup table &> dmestup_table
dmsetup info -c &> dmsetup_info_c
# multipath -l
cat /etc/multipath.conf > etc/multipath.conf
multipath -l &> multipath_l
# log
dmesg > dmesg
tail -100 /var/log/messages > messages
# Block
ls -laR /dev > ls_laR_dev
lsblk > lsblk
findmnt > findmnt
# Archiving ...
tar -cf /tmp/"$FILENAME" $DIR 2>/dev/null
cd -
echo "======================================="
echo "Please upload the file:" /tmp/$FILENAME
echo "======================================="