Skip to content

Instantly share code, notes, and snippets.

@punksta
Created July 16, 2017 21:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save punksta/8688f684f1266197d55472be774e437b to your computer and use it in GitHub Desktop.
Save punksta/8688f684f1266197d55472be774e437b to your computer and use it in GitHub Desktop.
Create gpg encrypted tag.gz arhive
keyId="email or key id"
#prefix of output file
prefix="mybackup"
#current date current time
now=`date +"%m_%d_%Y_%T"`
path=$1
outputDir=$2
tarFile="$outputDir/${prefix}_${now}.tar.gz"
gpgOutPut="$tarFile.gpg"
tar -czf $tarFile $path
gpg2 --encrypt --output $gpgOutPut -r "$keyId" "$tarFile"
rm $tarFile
echo "$gpgOutPut created"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment