lnd-channel-s3-backup/files/lnd-channel-s3-backup.sh
author Luke Hoersten <luke@hoersten.org>
Thu, 23 Feb 2023 18:11:39 -0600
changeset 28 c94c54d5e61b
parent 19 5c8335b57353
permissions -rw-r--r--
lndcli was renamed to lncli.
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