lnd-channel-s3-backup/files/lnd-channel-s3-backup.sh
author Luke Hoersten <luke@hoersten.org>
Mon, 23 May 2022 21:00:48 -0500
changeset 22 99c49642ff78
parent 19 5c8335b57353
permissions -rw-r--r--
Update versions
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
19
5c8335b57353 Added lnd channel backup to s3 role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     1
#!/bin/bash
5c8335b57353 Added lnd channel backup to s3 role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     2
5c8335b57353 Added lnd channel backup to s3 role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     3
BUCKET=$1
5c8335b57353 Added lnd channel backup to s3 role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     4
CHAN_BACKUP=$2
5c8335b57353 Added lnd channel backup to s3 role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     5
5c8335b57353 Added lnd channel backup to s3 role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     6
aws s3 mb "s3://$BUCKET/"
5c8335b57353 Added lnd channel backup to s3 role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     7
aws s3api put-bucket-versioning --bucket "$BUCKET" --versioning-configuration Status=Enabled
5c8335b57353 Added lnd channel backup to s3 role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     8
5c8335b57353 Added lnd channel backup to s3 role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     9
while true; do
5c8335b57353 Added lnd channel backup to s3 role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    10
    inotifywait $CHAN_BACKUP
5c8335b57353 Added lnd channel backup to s3 role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    11
    aws s3 cp $CHAN_BACKUP "s3://$BUCKET/"
5c8335b57353 Added lnd channel backup to s3 role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    12
done