Skip to content

Commit

Permalink
pb-sos: effectively compress the pb-sos file with gzip
Browse files Browse the repository at this point in the history
Currently the pb-sos tool creates a TAR file with logs, but without
compressing it using gzip, for example. Even the output of command
says "Compressing...", but in fact no compression is done.

This patch uses gzip to effectively compress the logs. It achieves
83% of compression, observed after a simple experiment.
Also, makes use of $tarflags variable instead of pass the flags
directly in the command call.

Signed-off-by: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
  • Loading branch information
Guilherme G. Piccoli authored and sammj committed Jul 12, 2017
1 parent 135dc37 commit 3fc71b6
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions utils/pb-sos
Expand Up @@ -2,7 +2,7 @@

diagdir="diag"
tarfile="pb-sos.tar"
tarflags=""
tarflags="-cf"
corefile="/core"
verbose=0

Expand All @@ -28,7 +28,7 @@ fi
while [ $# -gt 0 ]
do
case "$1" in
-v) verbose=1; tarflags="$tarflags --verbose";;
-v) verbose=1; tarflags="--verbose $tarflags";;
-f) tarfile="$2"; shift;;
-d) desthost="$2"; shift;;
--) shift; break;;
Expand Down Expand Up @@ -69,7 +69,11 @@ cat /sys/firmware/opal/msglog > /$diagdir/msglog

log "Compressing..."
cd /
tar $tarflags -cf $tarfile $diagdir

tar $tarflags $tarfile $diagdir
gzip < $tarfile > $tarfile.gz
rm -f $tarfile
tarfile="$tarfile.gz"

echo "Complete, tarfile location $tarfile"

Expand Down

0 comments on commit 3fc71b6

Please sign in to comment.