Added GPG encryption by passphrase

This commit is contained in:
root 2022-06-05 15:15:39 +03:00
parent 5271dbbaeb
commit e7f6ee9b9b
2 changed files with 33 additions and 6 deletions

View File

@ -101,10 +101,36 @@ do
done
# Compressing
cd ${prefix}/${stamp} && tar -czf ${prefix}/compressed/${stamp}.tgz *
if [ "${do_quet}" == 0 ]
then
echo "Compressing"
fi
find ${prefix}/${stamp} -maxdepth 1 -type f -not -name "*.gz" -exec gzip {} \;
# Encrypting
if [ -n "${gpg_passphrase}" ]
then
if [ "${do_quet}" == 0 ]
then
echo "Encrypting"
fi
find ${prefix}/${stamp} -maxdepth 1 -type f -exec bash -c "echo \"${gpg_passphrase}\" | gpg --batch --passphrase-fd 0 --symmetric \"{}\" && rm -f \"{}\"" \;
fi
if [ "${do_quet}" == 0 ]
then
echo "Packing"
fi
# Packing
cd ${prefix}/${stamp} && tar -cf ${prefix}/compressed/${stamp}.tar *
rm -f $prefix/$stamp/*
rmdir $prefix/$stamp
# Sending data
if [ -n "${sshhost}" ]
then

View File

@ -2,8 +2,9 @@ sqldump_prefix="docker exec -t db mysqldump"
sql_list="dbname dbname2 dbname3:table:table"
files_list="/path/to/folder1 /path/to/folder/2:subfolder:file_in_folder:subfodler/subsub"
prefix='/path_to_temp_folder';
sshhost='host';
sshport=22;
sshuser='login';
sshkey='/path_to_ssh_private_key';
sshpath='/media/hdd2/backup';
#gpg_passphrase='my_super_secret_key'
#sshhost='host';
#sshport=22;
#sshuser='login';
#sshkey='/path_to_ssh_private_key';
#sshpath='/media/hdd2/backup';