blob: 88babe8df8d47f8e7d6a46cb10a96121a485b456 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#!/usr/bin/env bash
timestamp="$(date +"%Y%m%d-%H%M%S")-"
# If the backup location doesn't exist yet, create it
if [ ! -d $var_log_folder_destination ]; then
mkdir -p $var_log_folder_destination
fi
if [ -d $var_log_parent_source ]; then
cd $var_log_parent_source
else
exit 1
fi
echo "$var_log_folder_source -> $var_log_folder_destination$timestamp$var_log_folder_source$tar_suffix$gpg_suffix"
# tar in /tmp
tar cfJ $tmp$timestamp$var_log_folder_source$tar_suffix $var_log_folder_source --exclude='journal'
# gpg to var_log_folder_destination
gpg -e \
-r "$gpg_public_key" \
-o $var_log_folder_destination$timestamp$var_log_folder_source$tar_suffix$gpg_suffix \
$tmp$timestamp$var_log_folder_source$tar_suffix
# delete tar in /tmp
rm -f $tmp$timestamp$var_log_folder_source$tar_suffix
|