minor fixes
This commit is contained in:
parent
5f253533e4
commit
5292c9d434
16
btrbk
16
btrbk
|
@ -3,9 +3,9 @@
|
|||
source config.sh
|
||||
startDate=$(date +%s)
|
||||
|
||||
function main {
|
||||
date=$(date +%Y-%m-%d)
|
||||
month=$(date +%Y-%B)
|
||||
function bkRun {
|
||||
local date=$(date +%Y-%m-%d)
|
||||
local month=$(date +%Y-%B)
|
||||
for i in ${!SUBVOLS[@]}; do
|
||||
snapName=${VOLNAME[$i]}.$date
|
||||
snapLast=$SNAPDIR${VOLNAME[$i]}.$(date -d "$date -1 day" +%Y-%m-%d)
|
||||
|
@ -18,11 +18,11 @@ function main {
|
|||
else
|
||||
btrfs subvolume snapshot -r ${SUBVOLS[$i]} $SNAPDIR$snapName
|
||||
fi
|
||||
if [[ -d "$snapLast" && $bkType = "daily" ]]; then
|
||||
if [[ -d "$snapLast" && $1 = "daily" ]]; then
|
||||
btrfs send -p $snapLast $SNAPDIR$snapName | gpg --batch -er $PUBKEY -o - | rclone rcat $RCLONEDIR$month"-incr/"$snapName.pgp
|
||||
else
|
||||
btrfs send $SNAPDIR$snapName | gpg --batch -er $PUBKEY -o - | rclone rcat $RCLONEDIR$month"-full/"$snapName.pgp
|
||||
if [[ $bktype = monthly ]] && rclone ls $RCLONEDIR$(date -d "$date -1 month" +%Y-%B)-incr; then
|
||||
if [[ $1 = "monthly" ]] && rclone ls $RCLONEDIR$(date -d "$date -1 month" +%Y-%B)-incr; then
|
||||
rclone delete $RCLONEDIR$(date -d "$date -1 month" +%Y-%B)-incr/
|
||||
if rclone ls $RCLONEDIR$(date -d "$date -6 month" +%Y-%B)-full/; then
|
||||
rclone delete $RCLONEDIR$(date -d "$date -6 month" +%Y-%B)-full/
|
||||
|
@ -39,11 +39,9 @@ function main {
|
|||
|
||||
function testDate {
|
||||
if [ `date +%d` != "01" ]; then
|
||||
bkType=daily
|
||||
main
|
||||
bkRun "daily"
|
||||
else
|
||||
bkType=monthly
|
||||
main
|
||||
bkRun "monthly"
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue