lnd-channel-s3-backup/files/lnd-channel-s3-backup.sh
author Luke Hoersten <luke@hoersten.org>
Mon, 07 Oct 2024 23:30:59 -0500
changeset 36 8de33340cca9
parent 19 5c8335b57353
permissions -rw-r--r--
Added hacks to fix lnd bitcoind 28 bug.
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