Skip to content

Instantly share code, notes, and snippets.

@wuftymerguftyguff
Last active June 11, 2017 09:48
Show Gist options
  • Save wuftymerguftyguff/a4827d689a36aa861810b1f67713389b to your computer and use it in GitHub Desktop.
Save wuftymerguftyguff/a4827d689a36aa861810b1f67713389b to your computer and use it in GitHub Desktop.
Script to archive customer data in a SAP global dir
#This is a script to get the bits of the sapmnt global dir that you want during a migration
#but not the bits that you dont want
#first make sure we are in something that looks like a global dir
if [[ $(pwd) =~ ^/sapmnt/[A-Z0-9]{3}/global ]]
then
echo Great you are in the global directory
echo Generating Unique Archive filename
fname="$(cat /dev/urandom | tr -cd 'a-f0-9' | head -c 32).tar"
echo Archive filename is $fname
echo Creating Archive and adding WF_LOG_ logs
tar cf $fname WF_LOG_*
echo Appending all NNNJOBLG dirs
tar -rf $fname [0-9][0-9][0-9]JOBLG
echo Appending reginfo
tar -rf $fname reginfo
echo Appending secinfo
tar -rf $fname secinfo
#####Add extras here as needed
echo compressing output
gzip $fname
echo $fname.gz is now ready to be copied to target global dir
else
echo This script only works if you are in the global directory
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment