Added GPG encryption by passphrase
This commit is contained in:
parent
5271dbbaeb
commit
e7f6ee9b9b
28
backup.sh
28
backup.sh
|
@ -101,10 +101,36 @@ do
|
||||||
done
|
done
|
||||||
|
|
||||||
# Compressing
|
# 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/*
|
rm -f $prefix/$stamp/*
|
||||||
rmdir $prefix/$stamp
|
rmdir $prefix/$stamp
|
||||||
|
|
||||||
|
|
||||||
# Sending data
|
# Sending data
|
||||||
if [ -n "${sshhost}" ]
|
if [ -n "${sshhost}" ]
|
||||||
then
|
then
|
||||||
|
|
|
@ -2,8 +2,9 @@ sqldump_prefix="docker exec -t db mysqldump"
|
||||||
sql_list="dbname dbname2 dbname3:table:table"
|
sql_list="dbname dbname2 dbname3:table:table"
|
||||||
files_list="/path/to/folder1 /path/to/folder/2:subfolder:file_in_folder:subfodler/subsub"
|
files_list="/path/to/folder1 /path/to/folder/2:subfolder:file_in_folder:subfodler/subsub"
|
||||||
prefix='/path_to_temp_folder';
|
prefix='/path_to_temp_folder';
|
||||||
sshhost='host';
|
#gpg_passphrase='my_super_secret_key'
|
||||||
sshport=22;
|
#sshhost='host';
|
||||||
sshuser='login';
|
#sshport=22;
|
||||||
sshkey='/path_to_ssh_private_key';
|
#sshuser='login';
|
||||||
sshpath='/media/hdd2/backup';
|
#sshkey='/path_to_ssh_private_key';
|
||||||
|
#sshpath='/media/hdd2/backup';
|
||||||
|
|
Loading…
Reference in New Issue