summaryrefslogtreecommitdiff
path: root/scripts/vyatta-show-dmesg-all
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/vyatta-show-dmesg-all')
-rwxr-xr-xscripts/vyatta-show-dmesg-all9
1 files changed, 9 insertions, 0 deletions
diff --git a/scripts/vyatta-show-dmesg-all b/scripts/vyatta-show-dmesg-all
new file mode 100755
index 0000000..d511ea0
--- /dev/null
+++ b/scripts/vyatta-show-dmesg-all
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+shopt -s extglob nullglob
+
+declare -a zipped_files=($( printf "%s\n" /var/log/dmesg*.gz | sort -r ))
+declare -a plain_files=($( printf "%s\n" /var/log/dmesg!(*.gz) | sort -r ))
+
+[ ${#zipped_files[@]} -gt 0 ] && gunzip --stdout ${zipped_files[@]}
+[ ${#plain_files[@]} -gt 0 ] && cat ${plain_files[@]}