aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoïc Guégan <loic.guegan@mailbox.org>2024-07-04 12:36:52 +0200
committerLoïc Guégan <loic.guegan@mailbox.org>2024-07-04 12:36:52 +0200
commit04cd4621bf591ac3bcd7360c415d09929e741243 (patch)
treec8216ca4332febee746ffce232aad3074a650852
parentdeb082da5c14c0470788ee6eb9a37bed389650b6 (diff)
Improve script
-rw-r--r--README.md5
-rwxr-xr-xsysdump.sh9
2 files changed, 14 insertions, 0 deletions
diff --git a/README.md b/README.md
index 86daa93..c3bf768 100644
--- a/README.md
+++ b/README.md
@@ -14,3 +14,8 @@ Explore a dump (require `jq`):
Explore specific entries of a dump:
> ./sysdump.sh dump.json uname timezone
+
+# Notes
+- To get available entries see into `sysdump.sh`
+- Some commands require root permissions.
+If `sysdump.sh` is not run as root, these commands will not be executed.
diff --git a/sysdump.sh b/sysdump.sh
index bfb1f5d..46e9dd4 100755
--- a/sysdump.sh
+++ b/sysdump.sh
@@ -12,6 +12,10 @@ safecmd() {
command -v "$1" >/dev/null 2>&1 && $@
}
+safecmdroot() {
+ [ $(id -u) -eq 0 ] && safecmd $@
+}
+
dump() {
[ -z "$2" ] && return
entry=$1
@@ -60,6 +64,7 @@ dump "gid" safecmd id -g
dump "gids" safecmd id -G
dump "ipaddr" safecmd ip addr
dump "/etc/nftables.conf" safecat /etc/nftables.conf
+dump "/etc/group" safecat /etc/group
dump "/proc/cpuinfo" safecat /proc/cpuinfo
dump "/etc/os-release" safecat /etc/os-release
dump "/proc/zoneinfo" safecat /proc/zoneinfo
@@ -76,6 +81,10 @@ dump "lsmod" safecmd lsmod
dump "lspci" safecmd lspci
dump "lsirq" safecmd lsirq
dump "lsfd" safecmd lsfd
+dump "dmidecode" safecmdroot dmidecode -t system
+dump "fdisk" safecmdroot fdisk -l
+dump "env" safecmd env
+dump "top" safecmd top -b -n 1
dump "locale" safecmd locale
dump "timezone" safecat /etc/timezone
dump "systemctl" safecmd systemctl --no-pager