sudo apt install inotify-tools
Create a script file at the path of your choice: /path/copy-channel-backup-on-change.sh
#!/bin/bash
while true; do
inotifywait /path/to/.lnd/data/chain/bitcoin/mainnet/channel.backup
cp /path/to/.lnd/data/chain/bitcoin/mainnet/channel.backup /backup/path/channel.backup
done
chmod +x /path/copy-channel-backup-on-change.sh
Create file: sudo emacs /etc/systemd/system/backup-channels.service
[Service]
ExecStart=/path/copy-channel-backup-on-change.sh
Restart=always
RestartSec=1
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=backup-channels
User=ubuntu
Group=ubuntu
[Install]
WantedBy=multi-user.target
Start
sudo systemctl start backup-channels
Monitor
journalctl -fu backup-channels
Run at boot
sudo systemctl enable backup-channels
touch /path/to/.lnd/data/chain/bitcoin/mainnet/channel.backup
Look to see if the backup was updated
The benefit of this (the above) method is that it uses standard OS tools (cp file).
You could mount a backup disk (remote or cloud storage for example) and just copy the file to that mount point.
Easier to trust when you know exactly what's happening.