Skip to content

Instantly share code, notes, and snippets.

@thehandsomezebra
Created July 16, 2022 00:52
Show Gist options
  • Save thehandsomezebra/4e44323b8806f879fe25370104c48b08 to your computer and use it in GitHub Desktop.
Save thehandsomezebra/4e44323b8806f879fe25370104c48b08 to your computer and use it in GitHub Desktop.
Unpacking BOSH logs
if [[ -z "$1" ]]; then
echo "You did not enter a file to unpack."
echo "Please try again, running this as 'source unpack_bosh_logs.sh <filename of logs>'"
fi
todaysdate=`date +'%m-%d-%Y'`
mkdir -p "logs-$todaysdate"
tar -xzf $1 -C logs-$todaysdate
cd logs-$todaysdate
for FILE in *.tgz
do
echo "Unpacking $FILE"
foldername=${FILE:0:-4}
mkdir -p $foldername
tar -xzf $FILE -C $foldername
rm $FILE
done
cd ..
echo "Done. Unpacked logs can be found in logs-$todaysdate."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment