mirror of
https://github.com/mynodebtc/mynode.git
synced 2024-11-15 09:59:16 +00:00
31 lines
727 B
Bash
Executable File
31 lines
727 B
Bash
Executable File
#!/bin/bash
|
|
# NO LONGER USED - MIGRATED TO PYTHON
|
|
|
|
source /usr/share/mynode/mynode_config.sh
|
|
|
|
mkdir -p $LND_BACKUP_FOLDER
|
|
|
|
echo "Waiting on lnd channel backup..."
|
|
while [ ! -f $LND_CHANNEL_FILE ]; do
|
|
sleep 1m
|
|
done
|
|
echo "Channel backup found!"
|
|
|
|
# Always copy once to make first backup
|
|
cp -f $LND_CHANNEL_FILE $LND_CHANNEL_FILE_BACKUP
|
|
|
|
while true; do
|
|
# If file has been deleted, exit so we cat restart
|
|
if [ ! -f $LND_CHANNEL_FILE ]; then
|
|
echo "Channel file deleted... exiting."
|
|
exit 1
|
|
fi
|
|
|
|
# Wait for changes
|
|
inotifywait -e modify -e create -e delete $LND_CHANNEL_FILE
|
|
cp -f $LND_CHANNEL_FILE $LND_CHANNEL_FILE_BACKUP
|
|
echo "Backed up LND channels!"
|
|
done
|
|
|
|
# Should never exit
|
|
exit 99 |