Created
July 16, 2022 00:52
-
-
Save thehandsomezebra/4e44323b8806f879fe25370104c48b08 to your computer and use it in GitHub Desktop.
Unpacking BOSH logs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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